[jQuery] Passing a variable into the $('selector') function
Hi all,
I have a problem that I can't crack.
I have a function similar to this..
$.ajax({
type: "POST",
url: "some.php",
data: "name=John&location=Boston",
success: function(msg){
alert( "Data Saved: " + msg );
}
});
The data that gets passed back to the function from some.php is a
string which is the id of the div that I want to manipulate in the
callback function e.g. "#myDiv".
My question is how can I get that div from the callback function using
the msg variable because $(msg); doesn't work and neither does $
("'"+msg+"'");
Thanks in advance,
Stompfrog