RSS Forums RSS
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 272 | Replies: 2 | Thread Tools  Display Modes
Reply
Join Date: Jul 2007
Location: Surathkal
Posts: 142
Reputation: tuse is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 10
tuse's Avatar
tuse tuse is offline Offline
Junior Poster

PHP+Ajax Help

  #1  
Nov 29th, 2008
Hi!

I am using a code to echo a row in a database table using ajax.

The code is working correctly.

The ajax will send the response text as follows-

document.getElementById('outputText').innerHTML = httpObject.responseText;

My question is how can I retrieve individual fields into separate Id's?
My blog on .NET- http://dotnet.tekyt.info
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2008
Location: Delhi, India
Posts: 72
Reputation: sikka_varun is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 8
sikka_varun's Avatar
sikka_varun sikka_varun is offline Offline
Junior Poster in Training

Re: PHP+Ajax Help

  #2  
Dec 2nd, 2008
Hi..
With Ajax, the best way to code is leave the innerHTML blank.. As in dont code anything inside the div tag.. e.g. <div id="outputText"></div>

Do not put any design in the DIV tag.. Rather, put your design layout in the php file which you access through AJAX..
like...
Suppose $row is the array (whose value is taken from mysql_fetch_array)

[color]
echo "<table border='0' width='100%'>";
echo "<tr>";
echo "<td>";
echo $row[0];
echo "</td></tr>";
echo "<tr>";
echo "<td>";
echo $row[1];
echo "</td></tr>";
echo "</table>";
[/color]

Now you can put this layout from the php file which is called from AJAX in the innerHTML property of the div tag..
This is the best way i could find for using AJAX.
VâRûN
---Happy to Help---
sikka_varun@yahoo.com
Reply With Quote  
Join Date: Jul 2007
Location: Surathkal
Posts: 142
Reputation: tuse is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 10
tuse's Avatar
tuse tuse is offline Offline
Junior Poster

Re: PHP+Ajax Help

  #3  
Dec 2nd, 2008
Thanks for your reply.

Thats a really good idea!
My blog on .NET- http://dotnet.tekyt.info
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Similar Threads
Other Threads in the PHP Forum
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 9:05 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC