Hi, I am trying to update a div with the response back from an ajax call, the
trouble is I don't know what syntax to use or how to make it work properly.
$("[EMAIL PROTECTED]").click(function () {
// Firstly I grab the tags from the form I am replacing (upon clicking
submit)
var tags = $("[EMAIL PROTECTED]").val();
// Set the loading graphic
$(this).parent().html(" \"ajax.gif\" Saving...");
// Then make my ajax call
$.ajax({
url: "ajax-updatetags.php",
type: "POST",
data: "tags=" + tags,
dataType: "html",
complete: function (){},
success: function (html) {
$(this).parent().html(html);
},
error: function(){ alert("error") }
});
});
The line in my success function doesn't do anything
$(this).parent().html(html); (the saving graphic just stays forever and
ever!) I assume because parent is not related now we are in another
function? How do I get back to my div and set the html. It needs to be the
div we are in.
This all occurs in a $("div.tags").click(function() { as intially the div is
converted to a form, then the form tags are taken, passed to the ajax and
returned by the call upon success. Also how do I tell jQuery the request has
failed from my PHP? Is there a special header or the like to return?? Or at
least the page in the docs about this I haven't yet found anything on the
specifics.
Thanks for any help.
Simon
--
View this message in context:
http://www.nabble.com/Ajax-updating-a-div-tf2779403.html#a7754502
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/