[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
1
Posts: 18
Reputation: 363

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....
Image
B
65
S
23
G
7
Posts: 1,505
Reputation: 10,896

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
27
S
16
G
74
Posts: 981
Reputation: 41,681

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,650

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
1
Posts: 18
Reputation: 363


Return to How do I....?

Who is online

Users browsing this forum: jorgmaquoi, SignalOne and 20 guests