Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Ajax new user - Can't get any respnse

Ajax - no response

5:56 pm on Jan 22, 2012 (gmt 0)

New User

joined:Jan 22, 2012
votes: 0

I am trying to set Ajax up for a media server (hosting professor lectures).
I am trying to update my mysql, if someone likes a particular lecture.

However, I am not able to get any response what so ever. I am using an onclick - however, nothing happens. Check the code below - I have set up an if-else, with onreadyState, and for both the conditions (exhaustive), no change happens. Please suggest what I am doing wrong.

function show_jw()
var filepath=jwplayer('container').getPlaylistItem().file;
var xmlhttp;

if (xmlhttp.readyState==4 && xmlhttp.status==200)
document.getElementById("like").innerHTML="file found";
document.getElementById("like").innerHTML="file not found";

<input type="button" onclick=show_jw() value="like" />

on clicking the button, I should either see "file found" or "file not found". I see nothing (on chrome or firefox).
2:01 am on Jan 23, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 3, 2005
votes: 0

you need to set xmlhttp

var xmlhttp;
var xmlhttp = getXHR();

see link below for function getXHR