How to use ajax Php post method with Jquery?
//ajax starting with jquery
$(document).ready(function(){
$("#sbBtn").click(function(){
var userFname=("input#fname").val();
var userLname=("input#lname").val();
$.post("savedata_core.php",{uFname:userFname, uLname:userLname}, function(allData){
alert(allData);
});
});
});
php file : savedata_core.php
2
Answers
From
ajax jquery
documentation. you can see how to send ajax request.for your question. you can do it like this:
Welcome to Stack Overflow. Upon review of your code, I do see some specific issues and you did not state you encountered any errors. Consider the following improvements:
When you were attempting to collect the values, you did not use the proper jQuery syntax. Your variables would not contain the proper content.
Also check your browsers Network console to review the payload sent and received.