Denis McMahon
3/2/2015 10:14:00 AM
On Sun, 01 Mar 2015 17:26:10 +0000, Tim Streater wrote:
> In article <mcv7a9$dos$2@dont-email.me>, Denis McMahon
> <denismfmcmahon@gmail.com> wrote:
>
>>On Sun, 01 Mar 2015 00:20:00 +0100, Tony Johansson wrote:
>>
>>> I just wat to text how it works from javascript or jQuery.
>>> Is this possible or impossible?
>>
>>You can create json or xml documents and request them with ajax
>>requests.
>
> No you don't. What you are requesting is *data*, which can be in any
> format as long as the two sides agree on what the format is.
Yes he can. OP can do other things as well, but OP _CAN_ do as I
suggested for the purposes of testing javascript / jquery ajax.
I didn't say that was the only thing he could do.
Technically you're just requesting a response, which may or may not
include a body, but unless you want to write your own parser to convert
the body you're sending from your server into data for your javascript to
use on the client, json and xml tend to be the two formats that javascript
can process natively.
Having said that, you can eg send a b64 encoded jpg image and:
document.getElementById(img_id).attr("src", "data:image/jpg;base64," +
data);
This may well work for other media types such as music files, but richard
should note well that I have no intention of helping him with any such
project!
--
Denis McMahon, denismfmcmahon@gmail.com