[jQuery] Waiting for Ajax Response
I have a small function outside of the onload method of the rest, so it'll only be loaded for a specific page. $('#apost :text').change(function(){ var entry = $(this).val(); var name = $(this).attr(id); var holder = name+holder; $('#'+name).val(''); $.ajax({ type: POST, url: adddata.php, type: html, data: name+=+entry, success: function(msg) { $('#'+holder).html(msg); } }); }); The adddata.php file is in the same directory as the page requesting it. I tested the adddata page by itself and it behaves as it should. Also used an alert to make sure the variables are being set correctly. When I enter the data it clears as should, but the response is never inserted. I look in Firebug and the header just says Loading... Other Ajax requests work fine.
[jQuery] Re: Waiting for Ajax Response
Yeah, the response isn't being inserted using the $ ('#'+holder).html(msg); Usually firebug will tell me file not found or error from the file, but I'm getting nothing. I'll try your approach, see what happens.
[jQuery] Re: HTML in Ajax XML response
Never mind I got it working by stumbling across using CDATA in the xml response. On Sep 2, 1:38 am, atomicnuke [EMAIL PROTECTED] wrote: Is there a way to do this? I thought just placing the response in a div with html() would work, but it ignored the br /'s.
[jQuery] Slowing callback function
I'm trying in slideUp a div then fade in another when it has completed the slide. I tried using the fadeIn as a callback function $('slidediv').slideUp('slow', function() { $('fadediv').fadeIn('slow'); }); Is there a way to delay the fade, everything happens so fast you can't really tell the new div is even there.
[jQuery] Re: Slowing callback function
Still didn't seem to work On Sep 2, 8:28 pm, Erik Beeson [EMAIL PROTECTED] wrote: I assume your selectors are just for example since $('slidediv') isn't a valid selector (unless you have an element like slidediv.../slidediv, which you probably don't have if you're doing HTML). To delay the second effect, you can use setTimeout, like so (untested): $('slidediv').slideUp('slow', function() { setTimeout(function() { $('fadediv').fadeIn('slow'); }, 750); }); Where 750 is the number of milliseconds to delay. --Erik On 9/2/07, atomicnuke [EMAIL PROTECTED] wrote: I'm trying in slideUp a div then fade in another when it has completed the slide. I tried using the fadeIn as a callback function $('slidediv').slideUp('slow', function() { $('fadediv').fadeIn('slow'); }); Is there a way to delay the fade, everything happens so fast you can't really tell the new div is even there.
[jQuery] HTML in Ajax XML response
Is there a way to do this? I thought just placing the response in a div with html() would work, but it ignored the br /'s.
[jQuery] Re: JS stops running
Still trying, if I comment out the $.ajax section and put an alert after that section the code runs, but once I uncomment the page just processes the default way. I get no errors in firebug or anything, so not sure why it just seems to skip the function.
[jQuery] Re: JS stops running
Was hoping someone could shed some light on this, but I'll post back if I find the problem, just hard with no errors.
[jQuery] JS stops running
I have the following function, it gets the data in a form and sends it to be verified before posting. $(#commentform form).submit(function(){ var uname = $(#commenter).val(); var email = $('#email').val(); var url = $('#website').val(); var commment = $('#commenter').val(); $.ajax({ type: POST, url: ../../../testingphase/blog/commenttest.php, dataType: html, data: commenter=+escape(uname)+'email='+escape(email) +website=+escape(url)+comment=+escape(comment), success: function(msg) { if(msg == 0) { $('#errormess').html(msg); } else { alert('Wow');} } }); return false; }); First I just set the variables and showed them in an alert to make sure I was targeting them. Then I added the ajax and on submit it just processes with php. I did the ajax just like my other post and get, but can't see why this one doesn't work.
[jQuery] Re: Problem with change()
Yeah, guess autocomplete will work, to lazy to write a timer function, lol. Quick unrelated question, I ran across a plugin for jQuery that if you inserted content in with Ajax the links won't be recognized by jQuery, but the plugin helps to fix that.
[jQuery] Re: Problem with change()
Yeah, guess I kind of didn't put that in a question format, again, thanks for the help.
[jQuery] Problem with change()
I wrote a function that check text fields in a form using change, it works for the most part. But if say they go to the email field and the remember function of the browser pops up and they click that instead of typing it, the change method doesn't detect it. There a way to deal with this?
[jQuery] Re: Beginner not getting it.
Yeah, I'm an idiot, the jQuery script was uploaded to the wrong directory for whatever reason. Sorry for the pointless post, lol. So far I'm tinkering with it and truly enjoying the potential I see jQuery offering. Thanks for not being mean about it!!
[jQuery] Help Traversing
script type=text/javascript src=jquery-1.1.4.js/script script type=text/javascript $(document).ready(function(){ $(#comments span h5 a).click(function(){ var author = $(this).parent(span).next(p).text(); alert(author); }) }); /script /head body div id=comments div id=5spanh4Minion/h4h5(a href=#Reply/a)/h5/ spanbr pBack to normal status/p /div /div I'm trying to figure out how to grab the text between the p tags when reply is clicked. I know I got the reply link targeted. I first just had an alert, but tried going further. At first I just had $ (this).next(p).text(); but thought maybe I needed to go to the parent, then move on, but it just shows a blank alert box.
[jQuery] Help Traversing
I hope this isn't a double post, my other one was over 12hrs ago and it never displayed. I'm trying to get the text out of a p tag, I can do this if I set an id name, but I don't want to id everything, since with jQuery I don't need to. The premise is I'm clicking a link and it gets two values and inserts them in a texarea. Inserting isn't the problem, just finding the values. $(document).ready(function(){ $(#comments span h5 a).click(function(){ var author = $(this).parent(span).next(p).text(); alert(author); }) }); div id=comments div id=5spanh4Minion/h4h5(a href=#Reply/a)/h5/ spanbr pBack to normal status/p /div /div I'm finding the link, I had an alert test, so I know it works. So I then tried to capture the data in the p tag. I just get a blank alert though. I tried without the parent at first, but got nothing. So thought I had to go up to the main tag before calling next, still nothing. While on topic, is there a way to get the value of an id tag? The number 5 will serve importance later.
[jQuery] Stopping a link from forwarding
I have the following code and was wondering how you stop a link from forwarding to the url when clicked? I'd assume it'd go inside the click, but couldn't find a way looking through the Visual jQuery. $(#pnav li a).click(function(){ $(#article).slideUp(slow); }); Also, not sure if anyone will get this message. This is the 3rd response/post I've tried that has not appeared. I've waited to see if they post, but never do.
[jQuery] Passing variable in jQuery
I'm trying to get the text of what I clicked for later in the function, but can't seem to pass it. $(#pnav li a).click(function(){ var page = $(this).text(); $(#article).slideUp(slow, function(page){ alert(page); }); return false; }); If I test the alert before I go into the slideup it works, do you have to pass it a different way or am I doing it right just wrong, lol?
[jQuery] Re: Passing variable in jQuery
So simple, thank you!
[jQuery] Beginner not getting it.
I've been trying to follow the tutorials for the simple things and they aren't working. This is just a short snippet: script type=text/javascript src=jquery-1.1.4.js/script script type=text/javascript $(document).ready(function(){ $(a).click(function(){ alert(Thanks for visiting!); }); }); /script /head body a href=#Click/a /body But I just get an error in firebug '$ is not defined on line $ (document).ready(function(){ I've been using mootools because I was daunted looking at jQuery, but thought I'd give it a try.