Jump to content



Recommended Posts

//In my quiz.html which is still in my localhost
function submitScore() {
    var fullname = document.getElementById("fullname").value;  
    var data="fullname="+fullname+"&Qone="+one+"&Qtwo="+two+"&Qthree="+three+"&Qfour="+three+"&score="+score;

    var request = new XMLHttpRequest();
    request.open('POST', 'http://www.musuan.net/asd/Store.php', true);
    request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    request.onload = function() {
      if (request.status >= 200 && request.status < 400){
      } else {


//already uploaded in musun.net

$name = $_GET['fullname'];
$one = $_GET['fullname'];
$two = $_GET['fullname'];
$three = $_GET['fullname'];
$four = $_GET['fullname'];
$five = $_GET['fullname'];
$score = $_GET['fullname'];

$query="INSERT INTO $usertable(fullname, score, Qone, Qtwo, Qthree, Qfour, Qfive) VALUES";
$query.=" ('$name','$score','$one','$two', '$three', '$four', '$five')";
$result=mysql_query($query) or die("Error:". mysql_error());
echo "Quiz result was successfully saved.";

Hey guyz I am trying to store the result of the quiz from quiz.html to a database using ajax but it wont connect and log says "XMLHttpRequest cannot load http://www.musuan.net/asd/Store.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access." please help me. thank you

Link to comment
Share on other sites

First of all, google the error and look on stackoverflow. Also not very Phaser related.
If both scripts are on the same domain you would have no issue. JSONP is used if you want to go between domains.

Short answer:
Put all the scripts on the same domain or use one of the techniques they say on stackoverflow.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...