darkray16
27 Jul 2010, 01:16 AM
Hello,
So, I have a javascript page which I need to send data to an external php page(probably through an XMLHttpRequest). The php script will connect to a SQL database and retrieve data (comments, username, and date) in array form.
The problem is I need to pass that array to the javascript function that called it.
The javascript page is a completely separate file from the php page.
I had searched around and some people suggested that in the php page, I "echo" out the data as XML. I looked this up and it's all a lot of new stuff that I gotta learn, but first I wanted to know if I'm on the right path and if not is there another way to do it?
BTW the page that is running the js script will not be reloaded, it's using AJAX to call and not refresh the entire page.
So, I have a javascript page which I need to send data to an external php page(probably through an XMLHttpRequest). The php script will connect to a SQL database and retrieve data (comments, username, and date) in array form.
The problem is I need to pass that array to the javascript function that called it.
The javascript page is a completely separate file from the php page.
I had searched around and some people suggested that in the php page, I "echo" out the data as XML. I looked this up and it's all a lot of new stuff that I gotta learn, but first I wanted to know if I'm on the right path and if not is there another way to do it?
BTW the page that is running the js script will not be reloaded, it's using AJAX to call and not refresh the entire page.