File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes PHP and the fly likes php return true OR echo OR HttpResponse::send()? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Languages » PHP
Bookmark "php return true OR echo OR HttpResponse::send()?" Watch "php return true OR echo OR HttpResponse::send()?" New topic
Author

php return true OR echo OR HttpResponse::send()?

liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 134
Hi all,
I'm new to php. I have an .html page with an ajax call to php. I can reach the script, and it gets executed. The problem is I have no idea how to pass a value back into my .html page, the response to my ajax call. I have a basic php book that has nothing for it.
Do I need to have a method to have a return statement?
Ideally, I'd use HttpResponse::send(), but I can not get it to work - 500 error.

Please help, I'm lost! In all, I tested with:



Here is what my script looks like:



K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 1963
    
    7

Not sure where its your HttpResponse not returning or not working as it should but have you try using the old traditional AJAX approach using JavaScript getXmlHttpObject() stuff?

By the way, if your PHP script simply do send email, why not just return the status from the mail() function. But again currently that status is nowhere.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: php return true OR echo OR HttpResponse::send()?
 
Similar Threads
php to javascript
Using a Variable with AJAX
Writing to web space from Java applet.
Display of contents from TextArea
Submit dynamically created form with jQuery