Hi Friends,
//php value get in jquery in variabel
var php_id = <?php echo $id ?>;
$.ajax({
type:'POST', //post method
url:'ajax-file.php', // redirect URL
data:'start_test_id='+php_id, // POST DATA
success:function(html){
var obj = JSON.parse(html);
if (obj.success == 1){
alert('sucess');
} // success response in json
}
})
ajax-file.php
if(isset($_POST['start_test_id'])){
$php_id = $_POST['start_test_id'];
$insert_sql = $mysqli->query("INSERT INTO xx(yy) VALUES ('$php_id')"); // insert query
if($insert_sql == true){ //json response
$response["success"] = "1";
$test_check = json_encode($response);
}
}
I hope this answer helps for All. If you have an any queries
Send Mail - info@testwareinformatics.com
If you want to Learn more details about,
Thank you to All…
Original Source - www.quora.com