Turning $.post into $.ajax
Hi all,
This is very stupid but I cannot make it work.
I'm trying to turn the following:
-
$.post("search.php", { clientID: thisChannel.tblClient_id, channelID: thisChannel.tblChannel_Id, wordsToSearch: wordsSearchedfor }, function(data){
alert("data: " + data);
});
Into this:
-
$.ajax({
type: "POST",
url: "search.php",
data: "{'clientID':'" + thisChannel.tblClient_id + "','channelID':'" + thisChannel.tblChannel_Id + "','wordsToSearch':'" + wordsSearchedfor + "'}",
success: function(msg){
alert( "Data Saved: " + msg );
}
});
The first passes the variables with no problem, but I get an error with the ajax function, it is not passing the variables. What am I doing wrong?
Thanks a ton in advance!