PDA

View Full Version : I have PHP code, how to show output in AJAX in html page?


aviz70
04-04-2010, 10:58 PM
Hello experts,

I was asking this in PHP forum, but someone told me, i should check Ajax.

So i need your help. How can i have a PHP code which i have already, And i want to show it as scrolling ticker in my HTML page.

At the moment there is PHP code, which outputs in a .php page, as a tabular format. Like

Name - Buy Price - Sell Price
xx1
xx2
xx3


So how to make all those live prices scrolling, and output from PHP to the .html page..

Thanks

A1ien51
04-05-2010, 12:59 PM
You should forget about the scroll part first and just concentrate on getting the html onto the page. I am am going to assume that the php and the html page are on the same server. If they are you can use a simple Ajax call to get the content. You can use the responseText with innerHTML to add the html to the page.

If it is not on the same server, that you have to change the php page to use JSONP since Ajax can not make cross domain calls in every browser.

You could always use an iframe, but that is the not idea/solution.

Eric

aviz70
04-06-2010, 11:45 AM
Hello,

Well what i want to do is show the PHP code results in html page.

And yes both Html page and php code is in same server.

So you say the best way is to use Ajax ? And we can create Widget through it, so other people can copy a small source code, and easily show the scrolling ticker through our server in to there website, linking back to our website.

Thanks

A1ien51
04-06-2010, 12:54 PM
If you want people to copy the code, it can not be Ajax than. If the data does not have to be live, than you can use any old code that dynamically generates the array of options to display : http://www.google.com/search?q=JavaScript+tickers

First step get the ticker running.
Second step, make it dynamic.

Eric