 |
| Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 23rd, 2006, 03:57 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Problem with Ajax & PHP
Hello,
I am trying to write a check multi domain script by Ajax & PHP. User will input multi domains in seperate line by enter after each domain.
However, my PHP script backend can not split domains user inputed. You can test my AJAX at: http://www.liemonline.com/ajax
My getdata.php code:
<?
print_r(explode("\r\n", $_GET['domain']));
?>
Hope someone can help me. Thank you.
Regards,
|
|

June 23rd, 2006, 09:12 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
|
|
New lines aren't always the sequence "\r\n", it's possible that it's just an "\n" depending on the operating system.
The best thing to do is to strip out the "\r" character, so that you have consistency. You might also call encodeURIComponent() in the JavaScript, so that you are sending a proper URL-encoded string.
xhr.open("GET", "getdata.php?domain=" + encodeURIComponent(domain));
HTH!
Regards,
Rich
--
Author,
Beginning CSS: Cascading Style Sheets For Web Design
CSS Instant Results
http://www.catb.org/~esr/faqs/smart-questions.html
|
|

June 24th, 2006, 03:25 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello,
Thank you very much. However, I decided to split the data by Javascript before send to PHP with: split() function. (Javascript works well with \r\n)
Thank you.
|
|

August 17th, 2006, 09:16 AM
|
|
Registered User
|
|
Join Date: Feb 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hai,
you'd better use some special characters to split instead of \r\n. u may use sequence of ##, ~~ and so on.
|
|

September 23rd, 2006, 11:45 PM
|
|
Registered User
|
|
Join Date: Sep 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
I'm Newbie to Ajax getting problem to execute. What i'm asking is have i to add any libraries to work out ajax? I just bought a Book of wrox Publications of Professional AJax. I read basics even though its not working i'm getting error that "error on page" on status bar of IE. what i have to do to make it execute? I'm Using Php and Mysql as Back end and using versions 5.1.6 and 5.0.24 respectivley. Any Body answer me please...
Thank You...
|
|

December 14th, 2006, 07:35 AM
|
|
Authorized User
|
|
Join Date: Oct 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
dharprog;
try visit this sites http://ssuren.spaces.msn.com
i hope this can help;))
|
|
 |