I have this AJAX request:
function request(str){
Try this:
function form() {
var id = document.getElementById('id').value;
$("div2").text(id);
}
$(function() {
$("#submit").click(function() {
form();
});
});
The syntax for embedding a function call in a jQuery event was incorrect. If you want to execute another function inside a jQuery function, you have to do the above, not .click(function form() {});