[jQuery] newbie problem with Ajax
Hi, I have recently started using jQuery and am trying to parse an XML
document that I will load from a URL on the same host as that of the
page running the script.
Currently I am running XAMMP on OS X and I have a file test.html
located at
http://localhost/~rguha/jsdepict/test.html
This loads a file called parsecml.js (located in the same directory)
whose content is
$(function() {
$('#loadmol a').click( function() {
$.ajax({
type: "GET",
url: "ethane.cml",
dataType: "xml",
success: function(xml) {
alert("Loaded XML");
},
complete: function(req, status) {
// $('#content').append(status);
alert(status);
},
error: function(req, status, error) {
$('#content').html('<b>'+req+'</b>');
}
});
});
});
I'm facing two problems:
1. I keep on getting an error, i.e., the XML document does not get
loaded
2. When the error function modifies the div (id = 'content') , I see
it and then it immediately dissapears. Why does this happen?
I thought that if the target document was on the same host as the ajax
script it should load OK. At least I don't get the 'URI denied access
error'.
Any pointers would be much appreciated.
Thanks,
Rajarshi