Hello Everyone, today I will guide you "To pass JSON in AJAX ".
In the below code information is a variable that store JSON. We can pass this variable into AJAX data and get user records, and show it into a userDetail <div>.
You can use the below code for the same.
<script>
var information = ['hi','hello'];
$.ajax({
type: "POST",
data: {info: information, "action": "getUserRecords"},
url: "/var/www/pinboard/wp-content/themes/pinboard/userinfo.php",
success: function(msg) {
$('.userDetail').html(msg);
}
});
</script>
0 Comment(s)