-1

I have five separate, although related, strings of text which I need to transfer from the server (PHP) to the client (JS). I intend to use AJAX, but I've only ever used AJAX for transmitting a single line of plain text.

So, I'm wondering what options I should explore, XML, JSON, etc. in order to best transfer the information, and how to prepare/receive the information.

fvgs
  • 21,412
  • 9
  • 33
  • 48

1 Answers1

1

It is easy in PHP to convert data types over to JSON, via json_encode.

XML is only slightly more cumbersome, in that you have to generate the DOMDocument yourself.

There is a breakdown of the pros/cons here: https://stackoverflow.com/questions/3536893/what-are-the-pros-and-cons-of-xml-and-json

Community
  • 1
  • 1
Alex W
  • 37,233
  • 13
  • 109
  • 109