Call AJAX file twice
Call AJAX file twice
I'm calling a file using AJAX twice in a webpage. Once when the page loads and then again when a button is clicked. Both calls would execute different functions, but would be using the same file to do so. The first time the AJAX call works, but then when the button is clicked it doesn't. I'm not sure if I can have more than one AJAX call to the same file in the same page, or maybe my code needs to be modified a bit, but I listed it below. Thanks in advance.
Zeeshan Syed
- $(function(){
$.ajax({
type:"GET",
url:"notice_board.xml",
dataType:"xml",
success: checkData,
error: function(){
alert("Couldn't load XML file");
}
})
$("#notice_board").bind("click", function(){
$("div.notice").slideDown("slow").show();
$.ajax({
type:"GET",
url:"notice_board.xml",
dataType:"xml",
success: parseXml,
error: function(){
alert("Couldn't load XML file");
}
})
}
});
});