help me... AJAX no return data!!!

  • tutorial example why it does not return the loaddata ? where am I wrong?

    tnks?

  • If your running your capx in preview mode and not from the same the server the AJAX file is loaded on then your server will by default ignore the ajax request. Its a security function of php to prevent outside connections from accessing any data you don't want them to. On your AJAX file you need to add a header call to allow access from out side connections.

    <?php header('Access-Control-Allow-Origin: *'); ?>[/code:1gxtpvwe]
    
    How ever you need to do more reading on this subject as this line above will open up your server to to all outside requests. Its dangerous to leave it in place as is but for testing this should fix your problem
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I try immediately ... thanks

  • thanks so much it works

  • Hi! I tried to use AJAX to load a local text/config file (node webkit export) but it returns no data (only a 404 not found error) if it runs in node webkit preview mode.

    When I export it it works. Is it possible to fix/change this somehow?

    Example:

  • From manual, this might apply to your situation :

    [quote:gqqw1emt]Note that previewing with node-webkit runs node-webkit directly from the Construct 2 install directory. As a consequence, the AppFolder expression will return <install path>\exporters\html5\node-webkit\win32. If this poses a problem for you, use the following workaround: have a global string variable; if 'Is in preview' is true hard-code it to some development folder somewhere else, otherwise set it to NodeWebkit.AppFolder. Then use the global variable instead of the AppFolder expression.

  • Oops. Thanks, I missed that one.

    I usually have the manual open everytime I open Construct.

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