jQuery load php file (and send a value)?
Trying to load insert.php?id=#### into a div on the page
#### is a number that is from a form here’s my code:
The form:
jQuery stuff:
$(document).ready(function(){
$(“#Add_Form”).submit(function() {
var ID = $(‘#ID’).attr(‘value’);
$(“#Add_Load”).get(“insert.php”, { “ID”: ID } );
return false;
});
});
- Category: JQuery Questions
Trying to load insert.php?id=#### into a div on the page
#### is a number that is from a form here’s my code:
The form:
jQuery stuff:
$(document).ready(function(){
$(“#Add_Form”).submit(function() {
var ID = $(‘#ID’).attr(‘value’);
$(“#Add_Load”).get(“insert.php”, { “ID”: ID } );
return false;
});
});
Other Questions
Login
Search
Recent Comments
- dgdg_dasdad on How does JQUERY DIFFER FROM JAVASCRIPT ? WHAT IS ITJQUERY ?
- Anas Imtiaz on How does JQUERY DIFFER FROM JAVASCRIPT ? WHAT IS ITJQUERY ?
- David D on How does JQUERY DIFFER FROM JAVASCRIPT ? WHAT IS ITJQUERY ?
- Wolfman on How does JQUERY DIFFER FROM JAVASCRIPT ? WHAT IS ITJQUERY ?
- TnT on Having a Jquery PHP problem?


Chris G
Posted 1 year ago
The $.get() method in jQuery isn’t used on elements, as you’re trying to do with:
“$(“#Add_Load”).get(“insert.php”, { “ID”: ID } );”
It is actually used to load a remote page using an HTTP GET request, in the form:
$.get( url, [data], [callback], [type] )
Where data is your form data, and callback is the function to do something with the returned data.
In your case, try something like this:
$(document).ready(function(){
$(“#Add_Form”).submit(function() {
var ID = $(‘#ID’).attr(‘value’);
$.get(“insert.php”, { “ID”: ID },
function(data){
$(“#Add_Load”).html(data);
});
return false;
});
});