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() {});
I think this code is broken:
<script>
$(function() {
$("#submit")
.button()
.click(function form() {
});
});
function form(){
var id = document.getElementById('id').value;
$("div2").text(id);
}
</script>
Not sure that this will totally fix it but I think this is the right syntax:
<script>
$(function() {
$("#submit")
.button()
.click(function() {
form();
});
});
function form(){
var id = document.getElementById('id').value;
$("div2").text(id);
}
</script>
I don't think this will solve your problem though but that syntax you were using wasn't formed right. I think instead of calling the function like this:
form();
You may also be interested in looking at .trigger() or .call(), I also looked at the jquery documentation and I have never seen .button(), what is that for?
I could be wrong but shouldn't the <script>
tag come before the function?
<script>
function request(str){
var aircraft = $("#div");
aircraft.load("./file.php?icao="+str, function(){
});
}
<script>