Sending a value from a dropdown box to PHP via jQuery -
I am trying to take a dropdown box and send it to a PHP file Depending on the chosen combination, a MySQL database and AJAX are displayed in a single divide without refreshing the page. I have a second part sorted, but I'm stuck on the first part.
Here's the HTML:
The main document's main part of my JavaScript code is:
var mode = $ ('# mode'); Find function ($ .post ('data.php', {name: form.him.value, the_key: # mode.val ()}, function (output) {$ ('# fear') .html (output My PHP (for testing purposes): $ the_key = $ _POST ['the_key']. ]; Echo $ the_key;
I have a variable in PHP which I can manipulate it, but I'm having trouble bringing it there. Where do I go from Thank you for your answers!
Callback function Post server response is required.
$. Post ('ajax / test.html', function (data) {$ ('results') .html (data);} );
Post this snippet for Ajax / Test. Html and your answer will be called with the parameter data that answers the anonymous function. This then sets the class in this anonymous function, resulting in Server response is the value.
Help? Let me know and if you have more information Shykta so we can work through it.
Additionally, there is a short form of $ .post in jQuery
$. Ajax ({type: 'POST', url: url, data: data, success: breakthrough data type: datatype});
Comments
Post a Comment