Jump to content

iammat

Members
  • Posts

    5
  • Joined

  • Last visited

iammat's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi firstly thanks for taking the time to look at this. In my application a user is able to create a chatroom and add friends to the chat room ( already complete) However I want the user to be greeted with a alert box saying "User X has invited you to chatroom Y" with the options "Accept", "Decline". If the user accepts then I want a new page to open which displays the chatroom they were invited to. My chatrooms are represented with roomids in a mysql database. Could anyone give me any hints on how I might do this ? Thanks
  2. I must have removed it before posting the code.. sorry! I will enable E_ALL to get useful errors Thanks for the tips!
  3. Hi Jessica If i nav to the PHP file I just get a blank screen ( unless I comment out the if statement) in which case I get "Hello"
  4. Hi Everyone I know this is technically a javascript question.. but I was looking for some help. I have the following js function which is located in its own file named checkUsername.js : function checkUsername(){ var status = document.getElementById("usernamestatus"); var u = document.getElementById("uname").value; if(u != ""){ status.innerHTML = 'checking...'; var hr = new XMLHttpRequest(); hr.open("POST", "passUsername.php", true); hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); hr.onreadystatechange = function() { if(hr.readyState == 4 && hr.status == 200) { status.innerHTML = hr.responseText; } } var v = "name2check="+u; hr.send(v); } } I have the following PHP file named passUsername.php which is located in the same directory as checkUsername.js <?php include_once('../classes/validation.class.php'); echo 'Hello'; // Testing purposes ?> It seems the data is not being sent to the PHP file from the javascript file. On the HTML page the output "Checking..." appears but then nothing else. I have tried this with all code in the same file and it works, but I really do not want to jam everything into one file. Clearly I am calling the PHP file incorrectly in the js function, would anyone be able to tell me how I should call it? Thanks for your time!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.