[jQuery] Re: Dealing with errors when .find() on .ajax()

2009-08-14 Thread comslash.com

I don't think you can ignore this error ... It looks like you are
returning a JSON response, try turning data type to json and then
insert responseHTML.One into your find command ... as "One" is your
object ... see below.

$.ajax({
  url: 'http://www.examplepage.com',
   success: function(responseHTML) {
 var someText = $(responseHTML.One).find('#myDiv').html();
// you may need $('#'+responseHTML.One) ... if you are looking for
say an id ... or "." + ... if its a class
   },
 dataType: 'json'

 });


On Aug 14, 9:20 pm, nick  wrote:
> $.ajax({
>   url: 'http://www.examplepage.com',
>   success: function(responseHTML) {
>     var someText = $(responseHTML).find('#myDiv').html(); // This part
> returns a script error and aborts anything else from here
>   },
>   dataType: 'html'
>
> });
>
> The problem is that examplepage.com has a script error
>
> (Syntax error, unrecognized expression: {"One":"1")
>
> that is messing up anything that searches responseHTML. How can I
> ignore this error because all I need is a section of html that is not
> affected by the errant script.


[jQuery] Re: Dealing with errors when .find() on .ajax()

2009-08-15 Thread comslash.com

Not sure ... I have never tired that ... but you could try, to parse
it in the same way i would parse an xml document, with something like
this.

$.ajax({
  url: 'http://www.examplepage.com',
   success: function(responseHTML) {
 var someText = $('#One', responseHTML).html();
   },
 dataType: 'html'
 });

On Aug 15, 9:45 am, nick  wrote:
> Thanks, but its actually a full webpage im returning. Is there a way
> of only returning the section of html I want, similar to 
> load('http://www.examplepage.com#one')?
>
> On Aug 15, 12:07 am, "comslash.com"  wrote:
>
> > I don't think you can ignore this error ... It looks like you are
> > returning a JSON response, try turning data type to json and then
> > insert responseHTML.One into your find command ... as "One" is your
> > object ... see below.
>
> > $.ajax({
> >   url: 'http://www.examplepage.com',
> >    success: function(responseHTML) {
> >      var someText = $(responseHTML.One).find('#myDiv').html();
> >     // you may need $('#'+responseHTML.One) ... if you are looking for
> > say an id ... or "." + ... if its a class
> >    },
> >  dataType: 'json'
>
> >  });
>
> > On Aug 14, 9:20 pm, nick  wrote:
>
> > > $.ajax({
> > >   url: 'http://www.examplepage.com',
> > >   success: function(responseHTML) {
> > >     var someText = $(responseHTML).find('#myDiv').html(); // This part
> > > returns a script error and aborts anything else from here
> > >   },
> > >   dataType: 'html'
>
> > > });
>
> > > The problem is that examplepage.com has a script error
>
> > > (Syntax error, unrecognized expression: {"One":"1")
>
> > > that is messing up anything that searches responseHTML. How can I
> > > ignore this error because all I need is a section of html that is not
> > > affected by the errant script.


[jQuery] Re: How to rename cloned element id (increase by one)?

2009-09-25 Thread comslash.com

I haven't test this but its modified from another set of code i have
that is working to do this

var idNumber = 1;

function addElement(id){
if($('#span1').html()){
$('#span1').append($('#' + id + idNumber).clone());

$('#span1 #' + id + idNumber).attr('id', '#' + id + (idNumber + 
1));

idNumber++;
}
}

Here is my original code ...

// form effects
function addRequest(){

$('#genList').append($('#genItem.template').clone());

genNumber++;

$('#genList #genItem.template').removeClass('template').attr('id',
'genItem_' + genNumber).fadeIn('slow').find('input,select').each
(function(){
$(this).attr('name', $(this).attr('name') + '[' + genNumber + 
']');
});

}

Chris

On Sep 25, 6:31 pm, jan1979  wrote:
> Hello.
>
> I have following code:
>
>   function addElement(id) {    
>     $(document).ready(function(){  
>         if ( $("#span1") ) {
>            $(id).clone().prependTo("#span1");
>         }      
>     });  
>
>   }
>
> How can I rename cloned element? Should be fine to increase its name by one,
> e.g.: original id1 into cloned id2 and so on.
> --
> View this message in 
> context:http://www.nabble.com/How-to-rename-cloned-element-id-%28increase-by-...
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Re: Elements with similar names

2009-09-25 Thread comslash.com

try

$('input[name^=tx_qtde]')

try this page for reference on selectors http://docs.jquery.com/Selectors

Chris

On Sep 25, 10:12 pm, Carlos Santos  wrote:
> I have in one form, many, many text fields with similar names such
> as:
>
> tx_qtde1
> tx_qtde2
> tx_qtde3
>
> how i can select all this text fields without using a class, something
> like:
>
> $("tx_qtde * ")
>
> where the * is the numbers.
>
> Thanks for your time.
> Carlos Santos


[jQuery] Re: Elements with similar names

2009-09-25 Thread comslash.com

wow way to many of us jumped on that post at the same time

On Sep 25, 10:19 pm, "comslash.com"  wrote:
> try
>
> $('input[name^=tx_qtde]')
>
> try this page for reference on selectorshttp://docs.jquery.com/Selectors
>
> Chris
>
> On Sep 25, 10:12 pm, Carlos Santos  wrote:
>
> > I have in one form, many, many text fields with similar names such
> > as:
>
> > tx_qtde1
> > tx_qtde2
> > tx_qtde3
>
> > how i can select all this text fields without using a class, something
> > like:
>
> > $("tx_qtde * ")
>
> > where the * is the numbers.
>
> > Thanks for your time.
> > Carlos Santos


[jQuery] Re: I'll Donate $20USD to Jquery if you can teach me how to do this

2009-05-17 Thread comslash.com

$(function(){

$.ajax({
type: "GET",
url: "test.xml",
dataType: "xml",
success: function(data){
 $('day[name=Monday]>show', 
data).each(function(){
$(this).each(function(){
time   = 
$(this).find('time').text();
dj = 
$(this).find('dj').text();
showname  
=$(this).find('showname').text();

$('body').append(time + 
'' + dj + '' + showname +
'');
});
 });
}
});


});


[jQuery] Re: I'll Donate $20USD to Jquery if you can teach me how to do this

2009-05-17 Thread comslash.com

$(function(){

$.ajax({
type: "GET",
url: "test.xml",
dataType: "xml",
success: function(data){
 $('day[name=Monday]>show', 
data).each(function(){
time = 
$(this).find('time').text();
dj   = 
$(this).find('dj').text();
showname 
=$(this).find('showname').text();

$('body').append(time + 
'' + dj + '' + showname +
'');
 });
}
});


});


[jQuery] Re: I'll Donate $20USD to Jquery if you can teach me how to do this

2009-05-17 Thread comslash.com

donb because passing xml can be much smaller then passing the data
with html wrapped around it.

On May 17, 6:41 pm, donb  wrote:
> I can't figure out why you want to pass data in a non-usable format so
> you have to whack away at it with lots of code to turn it into what
> you need. Why not generate what you need to start with, so the task is
> reduced to simply requesting a chunk of html and inserting it into the
> DOM.
>
> On May 17, 3:09 pm, KrushRadio - Doc  wrote:
>
> > Hey Guys/Gals,
>
> > I have been able to use JQuery in the past, for simple things, and
> > after much hacking around, i have been able to get it to work.  I want
> > to embrace this technology, but I can't get past the examples.
> > They're very basic, and I can't wrap my head around how to move them
> > into real world scenarios.  I'm a dev, but not a javascript dev.  I
> > mean, i know how to do this in Javascript, using xpath and filters,
> > but i really want to use JQuery as the engine, to keep it consistant
> > with the rest of the project.
>
> > using Javascript, I would just do a
> > var tDay = Document.DOM.selectSinglenode("/schedule/day
> > [...@name="Monday"])
> > and then loop thru there and list out everything into my table, and
> > display the html
>
> > But i want to do this using JQuery.
>
> > Here is the sample xml:
>
> > 
> >         
> >                 
> >                         0800-1000
> >                         nonstop rock
> >                         nonstop music
> >                 
> >                 
> >                         1000-1200
> >                         nonstop rock
> >                         nonstop music
> >                 
> >         
> >         
> >                 
> >                         0800-1000
> >                         nonstop rock
> >                         nonstop music
> >                 
> >                 
> >                         1000-1200
> >                         nonstop rock
> >                         nonstop music
> >                 
> >                 
> >                         1200-1400
> >                         nonstop rock
> >                         nonstop music
> >                 
> >         
> > 
>
> > So, here's what i want to see... I can understand the code when i see
> > it, but i'd like to see the specific code.
> > So, the first part would be to isolate the attribute of "name" for the
> > "day" element,
> > Then how it loops thru each 'show' element, and find the 'time', the
> > 'dj' and the 'showname'.  once i get that, i can add them together
> > with the html and post it to the .append code.  I just don't
> > understand how the daisy chain would work from here.
>
> > Thanks for you help.  The application on this, will be end up being an
> > ajax app, where i pass it the day of the week (monday/tuesday/
> > wednesday) and it will display the shows for that day in order of
> > time.
>
> > ~Doc


[jQuery] Re: function delay

2009-07-10 Thread comslash.com

there are a bunch of plugins like this , just search for wait, pause,
or delay and you should find one that is much more complete then your
code you have.

On Jul 10, 11:34 am, Many  wrote:
> Why not a plugin like (small correction void should be a string)
>
> $.fn.delay = function(delay){
> if(typeof delay==="undefined") delay = 1000;
> return this.animate({"void":0}, delay);
>
> }
>
> This way you can call it like this
>
> $('#element').delay().effect('pulsate');


[jQuery] 1.3 :not(:first) selector

2009-01-19 Thread comslash.com

I just encountered a problem when using the :not(:first) selector in
1.3 .  Can i get a confirmation on if this is a bug, or should I write
this differently ?

// Does Not Work Now
$('.class1>.class2>div:not(:first)').each(function(){ $(this).hide
(); });

// Works With Full Selector
$('.class1>.class2>div:not(.class1>.class2>div:first)').each(function()
{ $(this).hide(); });

Thank You


[jQuery] Re: 1.3 :not(:first) selector

2009-01-19 Thread comslash.com

Karl thanks for the quick response, guess I should have checked the
bug tracker, just thought i was writing it wrong !


[jQuery] building a custom "speed"

2009-02-23 Thread comslash.com

I was wondering if any one could point me in the right direction for
creating a custom "speed" plugin that extends the current speeds.  For
example right now I use slideUp('slow'); .  But I want to use
something like slideUp('custom'); .  Where "custom" takes the height
of the object and computes the number of ms to return for slideUp.

ie

slideUp( (($(this).height / 470) * 1000) );

but I would like to write it like ...

slideUp('custom');

Thank You


[jQuery] Re: Trigger event for children on parent element remove event

2009-02-25 Thread comslash.com

I would check out the livequery plugin.

http://docs.jquery.com/Plugins/livequery

On Feb 25, 5:26 pm, sliver  wrote:
> Is there a way to trigger an event one element when another element is
> say, removed or hidden? In other words, maybe a way to register any
> number of elements to another element with callbacks to be called when
> a certain event occurs to the main element.


[jQuery] Re: AJAX help please

2009-02-25 Thread comslash.com

Try making sites a global variable, if that doesn't work put your ajax
call a function and pass i and possibly your other vars too or make
them global.  One thing you may want to look at is looping this in a
way that all of your ajax calls are not all at the same time, maybe im
mistaken but i don't believe that they que up like fx do,  instead you
should look at running them in sequence.

You may need to make some of your vars global or

On Feb 25, 8:55 pm, Will22  wrote:
> Here is my code:
>
>   $(document).ready(function(){
>
>         $('#submiter').click(function() {
>
>                 var sites=
> ["12seconds","brightkite","colourlovers","corkd","Dailymotion"];
>
>                 var username = $("input#username").val();
>
>                 for (var i=0;i                      $.ajax({
>
>                              method: "get",url: "boo.php",data:
> "site="+sites[i]+"&username="+username,
>
>                              beforeSend: function(){$("#loading").show
> ("fast");},
>
>                              complete: function(){ $("#loading").hide
> ("fast");},
>
>                              success: function(html){
>                                  $("#"+sites[i]).html(html);
>
>                              }
>                     });
>                 }
>         });
>
>     });
>
> On this line method: "get",url: "boo.php",data: "site="+sites[i]
> +"&username="+username,
> sites[i] just fine,
> but here:
> success: function(html){
>             $("#"+sites[i]).html(html);
>
> sites[i] is undefined
>
> Please advise
>
> Thank you


[jQuery] Re: Stripping last html tag within an area.

2009-03-08 Thread comslash.com

Try this.

$('article>p:last').replaceWith($(this).html());


On Mar 8, 7:22 pm, carbon  wrote:
> is it possible to use jQuery to strip a tag from a 'div' ?
>
> example:
>
> 
> hello world
> last paragraph
> 
>
> I would like strip the  tags from 'last paragraph'.


[jQuery] Re: jQuery IE7 Memory leak

2009-03-08 Thread comslash.com

I would have to guess that because you are using the .load() in such a
rapid way that the load commands are stacking up, you will want to
either increase your interval time or set something up that only one
load command is going out at a time.

On Mar 8, 7:42 pm, mif86  wrote:
> Hi!
>
> I'm having problems with all ajax updates, $("#element").load() etc.,
> gradually eating up IE 7's memory.
>
> Simple test case to reproduce:http://mif86.com/memtest.htm
>
> It periodically loads another page's html content (http://mif86.com/
> memtest2.htm) into a Div using jQuery's $("#element").load
> ("memtest2.htm").
> If you watch the memory usage in internet explorer, it will grow
> linearly with time.
>
> I've been googling all around, trying lots of tweaks and fixes, but
> nothing seems to work. Is there something i'm misunderstanding, or is
> there a bug in jQuery? or something else? :S
>
> Thanks


[jQuery] Re: Stripping last html tag within an area.

2009-03-08 Thread comslash.com

Try this ...

I did some testing and it seems that the $(this) was not selecting
correctly as before and the :last was selecting only the last p tag on
the page not every the last p tag in each article

$('article>p:last-child').each(function(){
 $(this).replaceWith($(this).html());
});

Explination ...

// selecting the last p tag in each article
$('article>p:last-child')

// for each of these p tags do ...
.each(function(){

// the current object
 $(this)

// replace the p tag with what ever is inside of the p tag including
other html tags (ie )
.replaceWith($(this).html());

// end the for each and selection
});


On Mar 8, 7:55 pm, carbon  wrote:
> just the tags , leaving the content 'last paragraph'.
>
> On Mar 9, 10:50 am, Karl Swedberg  wrote:
>
> > Do you just want to remove the  and  tags? Or do you want to  
> > remove the paragraph along with along with all of its contents? If the  
> > latter, then, yes, use ('article > p:last').remove();
>
> > --Karl
>
> > 
> > Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> > On Mar 8, 2009, at 7:44 PM, carbon wrote:
>
> > > Thanks, but that didn't work.
> > > what does the .replaceWith($(this).htlm() do?
> > > shouldn't we use something like 'remove' instead?
>
> > > On Mar 9, 10:37 am, "comslash.com"  wrote:
> > >> Try this.
>
> > >> $('article>p:last').replaceWith($(this).html());
>
> > >> On Mar 8, 7:22 pm, carbon  wrote:
>
> > >>> is it possible to use jQuery to strip a tag from a 'div' ?
>
> > >>> example:
>
> > >>> 
> > >>> hello world
> > >>> last paragraph
> > >>> 
>
> > >>> I would like strip the  tags from 'last paragraph'.


[jQuery] Re: ajax timeout question

2009-03-24 Thread comslash.com

Mathew,

I believe you can set the value to null or 0 to not have the request
time out ... but you may want to implement something on error instead
of this to say attempt the search again x times then print msg server
is busy or something along those lines.



On Mar 24, 10:51 pm, Mathew  wrote:
> i am using jquery ajax to load search results of a page. and am having
> a hard time finding an answer to this question regarding my timeout
> time
> i have jquery set to timeout 5000 before doing the success functions.
> i have noticed on my less than reliable connection that sometimes it
> takes longer then 5000 to complete the ajax call and if it does then
> the ajax fails to submit. i could up the limit but usually when my
> connection is good the call only takes 200. is tehre a way to match
> the timeout to however long the call takes?
> thanks