I've been reading and I know there are similar questions, but I found no answer of what I'm looking for.
So it's about, for(;;); while(1); before the json string is outputted by an Ajax response.
Now what I wonder is how will this work? I'd like to try to use the same technique as many famous sites does like Facebook with for(;;);
So in the ajax.php file this is what I think has to be done:
ajax.php
$arr = array("value" => "something", "moreValues" => "moreSomething");
die("for(;;);".json_encode($arr));
Now the respone would be:
for(;;);{"value":"something","moreValues":"moreSomething"}
What shall I do with this string now? shall i remove for(;;); with a substr or something and then use JSON.parse(string); (Then why did I even send the for(;;); in the response if i'm going to remove it directly..?
And how will this help me with security issues, and how will a "user" enter the infinity loop for(;;); if something is wrong?
I know I am missing something, and I haven't found any example which demonstrates how to perform this. Anyone? And please if you find this question as a duplicate, please refer to an example where it's demonstrated in CODE not in words. Thanks!