jQuery : Loading Text file using $.ajax -
i trying fetch data text file using jquery ajax. tried lot not figure out error. xhr.responsetext shows data in error success not show anything.
var img_url = 'getimages.txt'; $.ajax({ type:"get", url: img_url, error: function(xhr, ajaxoptions, thrownerror) { alert(xhr.responsetext); }, success:function(data){ alert(data); } });
update :
thrownerror shows contents of text file =
error: invalid xml: amit.jpg|dharmendra.jpg|hangover.jpg|kungfu.jpg|matrix.jpg
i think resolved problem providing datatype = "text"
set datatype option of ajax object html , not try read xml. or set right content-type header in page or handler produces plain text value. default jquery "intelligent guess" content type.
Comments
Post a Comment