[jQuery] Re: $.post callback broken in safari in new window.open()
i'm having a similar problem with $.get. the callback isn't fired for safari 4. -akume Thomas Bircher wrote: hello I'm opening a new window with window.open() In the new window a file is loaded with the following post data function: function ajaxPost(url,data){ $.post(url,data, function(data){ alert(data) }); , json); } If I call this function form within the new window everything is fine - If I call it from the opener window the callback function is broken - only in safari - ff works fine. any work around for this? 1000 thanks -- View this message in context: http://www.nabble.com/%24.post-callback-broken-in-safari-in-new-window.open%28%29-tp24425835s27240p24819710.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: $.post() callback
Thanks for your reply.I reviewed the code and it was a structure problem, I've set a few things up differently and now it works. Thanks :) On Mar 6, 10:01 am, James james.gp@gmail.com wrote: I don't see any issues with the code you posted. I suggest try removing some code from inside-out to debug. Start by removing the AJAX portion. Does it still follow through on the href? If not, it's the AJAX. Is so, something else is wrong. Remove the confirm, and test. Etc. On Mar 6, 2:56 am, bart b...@ivwd.nl wrote: Hi all, I'm running into some trouble using the jquery $.post function. I'm using it in my CMS to delete a page record and after the deletion to display the updated page with the just deleted page removed ofcourse. Needless to say AJAX comes in handy here because of the page refresh. Here's my code; $(document).ready(function(){ $('p.editblock a.del').click(function() { var table_id = $(this).parent().parent().attr('id').split('_'); if(confirm(Are you sure?)) { $.post('includes/inc/ajax/handledelete.php', { table: table_id[0], id: table_id[1] }, function(data) { $('#sitewrapper').html(data); }); } return false; }); }); So the php file handles the delete query with the database and in the callback I'm replacing all the #sitewrapper html with the output of the php file. This does work, and the page does get displayed properly (with the deleted item removed) but after that the code stops working. So if I'd want to delete another one it won't function, it doesn't even take the false; statement for the link instead of that it just follows the location of the href. If I do a refresh in the browser it works again but only for once to fall in the old pattern again... Anyone who can help me with this?
[jQuery] Re: $.post() callback
I don't see any issues with the code you posted. I suggest try removing some code from inside-out to debug. Start by removing the AJAX portion. Does it still follow through on the href? If not, it's the AJAX. Is so, something else is wrong. Remove the confirm, and test. Etc. On Mar 6, 2:56 am, bart b...@ivwd.nl wrote: Hi all, I'm running into some trouble using the jquery $.post function. I'm using it in my CMS to delete a page record and after the deletion to display the updated page with the just deleted page removed ofcourse. Needless to say AJAX comes in handy here because of the page refresh. Here's my code; $(document).ready(function(){ $('p.editblock a.del').click(function() { var table_id = $(this).parent().parent().attr('id').split('_'); if(confirm(Are you sure?)) { $.post('includes/inc/ajax/handledelete.php', { table: table_id[0], id: table_id[1] }, function(data) { $('#sitewrapper').html(data); }); } return false; }); }); So the php file handles the delete query with the database and in the callback I'm replacing all the #sitewrapper html with the output of the php file. This does work, and the page does get displayed properly (with the deleted item removed) but after that the code stops working. So if I'd want to delete another one it won't function, it doesn't even take the false; statement for the link instead of that it just follows the location of the href. If I do a refresh in the browser it works again but only for once to fall in the old pattern again... Anyone who can help me with this?
[jQuery] Re: $.post callback problem
It looks like you have a rogue parenthesis to me - $.post($(this).attr(href)) - the last closing parenthesis completes the $.post call, so your callback function will not fire. on 11/09/2008 21:49 Tom Shafer said:: i am trying to use data i am getting back from $.post but I am not able to get the function with the data in it to work $(a.rater).click(function(event) { $.post($(this).attr(href)), function(data) { update = data.split('|'); $('#'update[0]).replaceWith(update[1]); }; return false; } ); i also tried $(a.rater).click(function(event) { $.post($(this).attr(href)), function(data) { alert(+data); }; return false; } ); any suggestions?
[jQuery] Re: $.post callback problem
i am trying to use data i am getting back from $.post but I am not able to get the function with the data in it to work $(a.rater).click(function(event) { $.post($(this).attr(href)), function(data) { update = data.split('|'); $('#'update[0]).replaceWith(update[1]); }; return false; } ); What does Firebug report that the response from the post is?
[jQuery] Re: $.post callback problem
I've had problems with not specifiying the 'data' to be sent to the server on a post ,ie: $.post(url,{data:{}}); You might try that and see if it fixes it On Sep 11, 3:32 pm, Mike Alsup [EMAIL PROTECTED] wrote: i am trying to use data i am getting back from $.post but I am not able to get the function with the data in it to work $(a.rater).click(function(event) { $.post($(this).attr(href)), function(data) { update = data.split('|'); $('#'update[0]).replaceWith(update[1]); }; return false; } ); What does Firebug report that the response from the post is?