The script message is working fine, it just executes my php code in the background when the page loads. What I can not do is run php in the background after clicking the submit button. I tried adding a form to the body, but I don’t know how to associate it with ajax .. how can this be done? thank!
<html>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
<script src="http://malsup.github.com/jquery.form.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
url: 'trial.php',
beforeSend: function() {
$("#myStatusDiv").html("started..");
},
success: function(result) {
$("#myStatusDiv").html(result);
}
});
});
</script>
</head>
<body>
</body>
</body>
</html>
source
share