data to php and which can be further processed and added to database?
This is in index.html
<script type =text /javascript >
$.ajax({url:"http://localhost:8080/a/insert.php", type: "post", data: {fname:'Sidharth' , lname:'Jain' }});
$.get("http://localhost:8080/a/insert.php", function(data){
alert(data) ;}
</script>
And this in insert.php
<?php
$fname = $_POST['fname'] ;
$lname = $_POST['lname'] ;
echo "My name is ".$fname." ".$lname ;
?>
...you are already done... Your PHP now needs to put that stuff into the database. If further processing is needed you eithger extend your PHP backend with the neccesary logic, or your JS and then just send it to the PHP Also make sure to use isset() in the PHP
Обсуждают сегодня