My Ajax isnt working...

0 favourites
  • The php webpage echos my response just fine...

    I do am having trouble however getting the AJAX.lastdata from it...

  • I don't understand, do you receive "1" from AJAX or not?

    Try changing the "last" variable to string type, or use int(AJAX.LastData) to convert "1" string to number.

    If you don't receive any response from AJAX, check error messages in browser console log (F12)

  • I made the changes....

    my var last is now a string... and I still am not receiving anything in AJAX last data...

    lemme show you...

  • If you don't receive any response from AJAX, check error messages in browser console log (F12)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Where should I check the console log?

    on my php website??

    this is what I get there...

  • Wow that helped so much!!

    Its saying my code for Acces from all origin isnt working...

    I will show you..

    Ok what should I do now?

  • You could try and add these headers right before the request:

    header: "content-type"

    value: "application/xml"

    header: Access-Control-Allow-Origin

    value: "*"

    header: "Access-Control-Allow-Headers"

    value: "*"

  • How do I do that?

    I tried adding a script and putting this code in there and making it before the request....

    and it didnt work...

  • How do I do that?

    I tried adding a script and putting this code in there and making it before the request....

    and it didnt work...

    In construct editor, right above your Ajax send request.

    Add:

    Action: Ajax Object -> Set request Header

  • I did everything you said...still not working...

    edit: Btw just to mention... I even created a new project and tried to use AJAX there and it isnt working as well....

  • Hmm, what does the web tool tell you in response ?

    chrome: ctrl + shift + j, tab network, with this open, press F5 for reload.

    click on the request (the url should show) in the second tab from the left, and then investigate the tabs headers and response relating to your request.

    Should give a clear indication of whats going on.

  • this is what I get there..

  • this is what I get there..

    Above this console are a row of tabs, one is called the network tab. Check there.

    With that tab open, reload the page, you should see a list of urls flying by being used by your app. Your requested url is among them. Find it in that list, click it, and to it right should show a "headers" and "response" tab ... be sure to check those.

  • This is what i got...

  • what status error code do you get on the header?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)