[SOLVED] Problem with AJAX and PHP

Get help using Construct 2

Post » Sat Mar 12, 2016 1:08 pm

I have php file on my hosting that echo-ing string "Najblizi je Joakim: 20m",
when i try to display that string in my app with AJAX(ajax.lastdata) it shows string + some javascript

Events:
button on click ===> ajax request url:"http://myurl.com/file.php"
ajax on completed ===> text1.text = ajax.lastdata

Result:
http://i68.tinypic.com/2ce0r3r.jpg

How to remove that javascript ?
Last edited by Deda on Mon Mar 14, 2016 10:09 am, edited 1 time in total.
B
7
S
2
Posts: 18
Reputation: 513

Post » Sat Mar 12, 2016 4:52 pm

If you always get . your text <script>.....................</script>
you can set text to tokenat(AJAX.LastData,0,"<")
is not the solution, but....
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Sat Mar 12, 2016 11:09 pm

You have a bug in your PHP script, it looks like it returns too much. Post the screen of the part where you return that data.
ImageImageImage
B
28
S
17
G
82
Posts: 1,034
Reputation: 45,912

Post » Sun Mar 13, 2016 1:03 am

It's probably free hosting automatically inserting tracking scripts/google analytics into every page.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,670

Post » Mon Mar 14, 2016 10:08 am

ramones wrote:It's probably free hosting automatically inserting tracking scripts/google analytics into every page.

Yap, it is.
Just changed host, now it works perfectly.
Thanks.
B
7
S
2
Posts: 18
Reputation: 513


Return to How do I....?

Who is online

Users browsing this forum: DiegoSanudoDT and 12 guests