How do I use ajax plugin to get data from url

Get help using Construct 2

Post » Sun Nov 27, 2016 2:06 pm

Message: ASHKAR can only post plain text URLS until they have 500 rep. 3 URLS modified. Why?
Hi there,

i wanna to make project use ajax to get data from url

so i read this Tutorial ((AJAX Example with Construct 2))
https://www.scirra.com/tutorials/61/aja ... t-2/page-1

and download the attached project

when i try the demo url
http://www.jtadeo.com/scirra/ajax/ajaxexample1/
it works fine

but when i download the project and run the layout it doesn't work

i make a demo and not work

Here are the work files:
http://www.jtadeo.com/scirra/ajax/ajaxe ... le1tut.zip

can any one help me?
B
7
S
2
G
4
Posts: 8
Reputation: 2,491

Post » Mon Nov 28, 2016 6:24 am

May be it need to send through https or needs to be uploaded to server first before making a call.. Just a guess.
B
49
S
14
Posts: 75
Reputation: 3,590

Post » Tue Nov 29, 2016 10:15 am

may be
but this will be mobile app .. it should be work !!
B
7
S
2
G
4
Posts: 8
Reputation: 2,491

Post » Wed Nov 30, 2016 11:01 am

Any Help !
B
7
S
2
G
4
Posts: 8
Reputation: 2,491

Post » Wed Nov 30, 2016 12:32 pm

The example doesn't work ,because there is an access violation. Only the access from one specific server is allowed. You can see it yourself if you press F12 in your browser(Chrome, FireFox) an look at the console.
You have to use your one sever with php to test the example.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Wed Nov 30, 2016 2:12 pm

Message: ASHKAR can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Sorry but i can't get it

say i have this domain http://www.samsung.com/sitemap.xml

and i wanna to get it's data and show it at my project

how can i make it ?
B
7
S
2
G
4
Posts: 8
Reputation: 2,491

Post » Wed Nov 30, 2016 4:00 pm

You will have a little experience in php to get this work. However to load a xml-file from a server:

You have to put a php-file and the xml-file on your server.
myphpfile:
Code: Select all
<?php
header('Access-Control-Allow-Origin: *');
$str = file_get_contents('myxmlfile.xml');
echo $str;
?>


in C2:
Code: Select all
System| On start of layout-> Request "http://myserver.com/myphpfile.php"  (tag"getxmlfile")
AJAX| On  "getxmlfile" completed -> Load XML document from string AJAX.LastData


Now after you loaded your xml-string in the Construct2 XML-Object and can parse it or do what you want.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Thu Dec 01, 2016 12:44 pm

Nice :)
works fine :)
Thanks Alot @Asmodean :)
B
7
S
2
G
4
Posts: 8
Reputation: 2,491


Return to How do I....?

Who is online

Users browsing this forum: 7Winter, HellMax, Lordshiva1948, Matei511, Yahoo [Bot] and 57 guests