I have used AJAX lots before and I wondered if it was possible to set variables from an AJAX file E.G. an ajax file could set
var set1 = 10;
var set2 = 55;
with both variables coming from an external file called by AJAX
Could you tell me the JS side for performing the request and the format of the file that is requested.
There's a difference in syntax in that js's split()/join() are methods of String and Array respectively, whereas in PHP explode()/implode() are top-level functions that take string/array as parameters.
Personally I prefer the js approach because it's easier to form a ".daisychain" of methods than to embed functions ever deeper in each other's parentheses. For example, the following js statement would be (imho) rather messy in php and arguably better coded on more than one line:
var str = .join(' ').replace('Hope', 'Trust').toUpperCase();
This is of more than just academic interest, particularly in AJAX applications where you can sometimes (often?) choose to process string data either server-side or client side.