...

View Full Version : jquery



esthera
03-10-2011, 07:07 PM
sometimes when running

$.ajax({
url: urltoajax,
cache: false,
success: function(html) {
$("#formfields").html(html);
}
});

in jquery from a link

meaning i call my javascript function on click of the link - instead of replacing the div it ads a new one with the new content
it should replace the div called #formfields

oesxyl
03-10-2011, 08:19 PM
sometimes when running

$.ajax({
url: urltoajax,
cache: false,
success: function(html) {
$("#formfields").html(html);
}
});

in jquery from a link

meaning i call my javascript function on click of the link - instead of replacing the div it ads a new one with the new content
it should replace the div called #formfields
put your code between [ code] and [ /code] tags, please.

try this way:


$.ajax({
url: urltoajax,
cache: false,
success: function(data) {
$("#formfields").replace(data);
}
});


best regards

esthera
03-10-2011, 08:27 PM
this gives me an error

oesxyl
03-10-2011, 08:33 PM
this gives me an error
i didn't test it, and now i just look thru jquery docs, is replaceWith

http://api.jquery.com/replaceWith/

try this and if you get an error, post the error to.

forget to say, was my fault, :)
best regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum