Alternative for AJAX?

Issue

Alternative for AJAX? Let’s say the client browser has disabled JS and therefore AJAX cannot work so is there an alternative for AJAX that I can use with PHP? Thanks…

Solution

I’d think that one possible way is having an <iframe> that has it’s src attribute set to a .php file that you call the file_get_contents() function on, and than you can get the URL from a textbox or something that is posting to it. Obviously be careful with user input, and to sanitize any data like that. Blog post describing sanitizing data here.

A problem with this is that most sites block requests that are made with that PHP function.

Your best bet is just putting up a <noscript> HTML tag and saying

Turn on JavaScript to use this website.

Or something like that.

Answered By – treckstar

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published