When i submit a jquery ajax request without the data value, it works, when i submit it with the data value, nothing happens. I check if it works using firebug. I think its a simple mistake but i cant seem to figure it out. Please Help.
Here is the Jquery Code
var inputString = $("something").val();
var suggestions = $.ajax({
url: "temp.php",
type: "POST",
data: {valueInput : inputString},
dataType: "html"
});
temp.php just has some simple code since I’m testing:
echo "We got sumn here";
another thing is the suggestions variable is empty, any ideas?
You can try:
Update
suggestionsis being set to the jqXHR object returned from the$.ajax()function. If you want to do work on the server-response then you need to set asuccesscallback somehow. Here are two ways:OR
I suggest the first method, the second is more advanced and is really only helpful if you want to wait for a set of AJAX requests to complete before doing something.