I'm using the following jQuery Ajax call... anyhow it's not working.
Error:TypeError: a is null
Here is my Code:
var prefixUrl = "autocomplete?action=complete&id=";
$('#complete-field').bind('keyup', function(){
var url = prefixUrl + escape($('#complete-field').val());
$.ajax({
type: "GET",
getUrl:url,
dataType: "xml",
success: function(responseXML) {
var composers = responseXML.getElementsByTagName("composers")[0];
if (composers.childNodes.length > 0) {
$('#complete-table').css("border", "1px solid green");
$('#complete-table').css("margin", "128px 0 0 -82px");
for (var loop = 0; loop < composers.childNodes.length; loop++) {
var composer = composers.childNodes[loop];
var firstName = composer.getElementsByTagName("firstName")[0];
var lastName = composer.getElementsByTagName("lastName")[0];
var composerId = composer.getElementsByTagName("id")[0];
appendComposer(firstName.childNodes[0].nodeValue, lastName.childNodes[0].nodeValue, composerId.childNodes[0].nodeValue);
}
}
},
error:function (xhr, ajaxOptions, thrownError) {
alert('xhr.status: ' + xhr.status);
alert(thrownError);
}
});
});
Any Idea please?
Many Thanks
$.ajax({
type: "GET",
getUrl:url,
...
should be
$.ajax({
type: "GET",
url: url,
...
See the docs at http://api.jquery.com/jQuery.ajax/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With