sayedsohail Posted August 2, 2007 Share Posted August 2, 2007 Hi everyone, I wish to split my results from php file and display in two different <div id='1'> </div> <div id='2'>, yes i am using ajax at client side and using php at server side. At the moment the result is fine and dispalyed in linear way. Any advise, how to split the response received from php files and what do i need to include in my php file to separate the echo statments within my php file. its probably more an ajax question. i will also post in ajax, sorry if you feel its duplication. Please help. Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted August 2, 2007 Share Posted August 2, 2007 Without code, there is little help we can provide. Use the javascript "split" to break apart a string...that's the best I can offer with what you've provided. Quote Link to comment Share on other sites More sharing options...
Philip Posted August 2, 2007 Share Posted August 2, 2007 Try this: In the ajax/js, after the response is received: var newData = request.responseText; var response = newData.split("|||"); // update the div, or do whatever with the strings document.getElementById('1').innerHTML = response[0]; document.getElementById('2').innerHTML = response[1]; ... In the php: <?php ... // where you are echoing the results: $results = $div_data_1 . " |||" . $div_data_2; echo $results; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.