Menu
  • HOME
  • TAGS

ajax ready state reachs 4 but status always is 200

ajax,jsp,servlets,safari,onreadystatechange

You need to set the status of the response server side, on your servlet. The AJAX client will get the response and store the status code on xhr.status. It is supposed to be a valid HTTP status code. Don't forget the response code has to be set before the response...

EventListeners, onreadystatechange, or jQuery for AJAX calls?

javascript,jquery,ajax,eventlistener,onreadystatechange

You can probably answer the performance question yourself with performance testing tools. I prefer event listeners because the code reads more cleanly. Bug-wise, I would categorize the lack of a way for the first method to break out of a callback loop if the service is down as a serious...

Multiple xhr onload

javascript,xmlhttprequest,onload,onreadystatechange

By onload, you mean multiple ajax.send? that is likely not the problem. Could is simply be that the returned ajax isn't returning something that matches your selector (magnet) or that your server doesn't answer properly to all requests? replace your console.log with a simple console.log ("Here be dragons"); If you...

How to execute alert of the audio duration when data is available?

javascript,function,audio,readystate,onreadystatechange

Why not use oncanplay event? Something like: var audio=new Audio("sample.mp3"); audio.oncanplay = function(){ alert(audio.duration); }; The oncanplay event fires when enough information has been and the audio is ready to start playing....