This Page has Moved
HTML_AJAX Info is now located at the HTML_AJAX wiki.
This page is sticking around since it has comments on it.
The weblog of Joshua Eichorn, PHP, AJAX and Open Source
HTML_AJAX Info is now located at the HTML_AJAX wiki.
This page is sticking around since it has comments on it.
Pingback: There and Back Again » Blog Archive » AJAX Hello World with HTML_AJAX
Pingback: Подробно » AJAX
Hello Josh, first of all, big thumbs up for phpDocumentor, i use it a lot! With 4 years of PHP experience i wanna dive into AJAX. I found XAJAX to be quite nice, but the project seems dead.
To be honest i want to use AJAX in a custom build application for form submission and to update html content in a list of returned records. For this, XAJAX does the trick. However, as i stated, the project “seems” dead because the project is ran by someone who is very very busy. When i looked further on the internet, especially conserning the PHP upload patch, i came to your site.
I really don’t know if i need to go and try HTML_AJAX or JSpan (which site is down atm due to SF tricks), or if i could still use XAJAX.
It would really help me if you would like to give an objective opinion about the 3 librarys, and comment if I could use HTML_AJAX for that what i want to do.
Gilles,
All 3 libraries will work for your situation. In CVS HTML_AJAX even has code for doing fake form submission over ajax.
Now as far as a project being alive thats a harder call. One of the reasons I created HTML_AJAX was because JPSpan was pretty much dead as far as new development goes. I haven’t watched XAJAX enough to know if its dead or not but developer activity is always important when picking a library.
I’m using HTML_AJAX for work so it will be getting quite bit of subsidized development from them in the next couple months.
Hi Joshua,
Thanx for your reply!
– Any chance you can adjust the PHP upload script to use HTML_AJAX instead of JSPAN?
– Any idea when the next version will be available?
Joshua, I want to submit a form via HTML_AJAX, and return an array consisting of three elements:
– one being a boolean stating wether the form is valid or not
– an array of (error-) messages
– an array of ID’s which i need to enable/change.
Something like: http://www.backbase.com/postcode/
Is that allready possible with the current version, and if so, can you post an example?
Gilles:
No clue on the upload stuff, it won’t take much but Its not a priority at the moment.
For the form submission stuff all the backend work you need is there, but there is no actual glue code yet. Would you mind joining the mailing list so we can cover in detail what kind of api you would like to see. Will at least get it planed for a release from there.
From xAjax’s web site: “xajax’s unique XML response / javascript message-pump system does the work for you, automatically handling the data returned from your functions and updating your content or state according to the instructions you return from your PHP functions. Because xajax does the work, you don’t have to write javascript callback handler functions.” Any chance you’ll be borrowing tips from their code any time soon? I like the idea of using a PEAR module rather than just random code that I have to throw around my server.
Were planning on adding an ability like that, but no one is currently working on it. If you’d like to help out, even if its just fleshing out the feature request, join the mailing list.
hi Joshua ,
i will ask a small question :
i have to pages and i want to move between these pages using ajax , can i do that ?
thanks
AmmAr: I’m not sure what you mean
You can load content from other pages into the current one using AJAX. The whole point is not to load a new page, if you want that just use a link a href
hi joshua,
i’m new to html_ajax,
i cant run the html_ajax examples,
would you please tell me how to settle the examples document
thanks
Johnson: I’ll need some more details to work things out. Feel free to use the mailing list of asking detailed questions. You’ll even get responses even when i’m not around.
http://lists.bluga.net/mailman/listinfo/html_ajax-devel
Wow !!!
That’s great. I have done that. Everything is working fine. I am uploading files and they are going right. I have a little problem. I want to send a confirmation mail to a specified mail about the file upload status, whether it has been uploaded or not. I am using move_uploaded_file function. Could you help me please???
Gajendra: Just send an email like you normally would after you run move_uploaded_file
Hi Joshua,
Thanks for your reply.
Could you tell me how to install it on shared hosting???
What if the file did not upload successfully. It still shows message “Uploaded successfully”. and where to use email sending code???
This is the code from demo.php
enableDebug();
}
if ($fileWidget->uploadComplete())
{
// output javascript to the iframe to send a final status to the main window
// this will catch error conditions
echo $fileWidget->finalStatus();
upload_file();
exit;
}
function upload_file()
{
$filename=$_FILES[“upload”][“name”];
$img_tmp_name=$_FILES[“upload”][“tmp_name”];
$mydir=”uploads”;
$message=”
File Transfer at $gmainurl
Hello,
Your file named $filename has been uploaded to $gmainurl
“;
if (move_uploaded_file($img_tmp_name, “$mydir/$filename”))
{
die(“Can’t copy File. “);
}
// mail upload status;
$headers = ‘MIME-Version: 1.0’ . “\r\n”;
$headers .= ‘Content-type: text/html; charset=iso-8859-1’ . “\r\n”;
$subject = “File transfer at $gmainurl”;
//$headers .= “From: $email” . “\r\n”;
@mail($_POST[“email”], $subject, $message, $headers);
}
?>
Could I add Percent of the upload to it. If yes, how???
On the error messages it depends on what the error is, some are hard to trap, it may be worth looking at the code to see what can be improved.
To get a percent status you need to be running on php 5.2 and have a upload status extension or you need to patch php and have an upload status extension
I tried your script for displaying bar while uploading the file but i am going to Javascript error message
As below Syntax error while calling uploadprogressmeterstatus.get_status()
Please help me this is very urgent for me.
Thank you
Hai: send me an email with the message javascript doesn’t work in comments
Hi Joshua,
Have you ever tried to use HTML_AJAX with Google Gears. In particular File upload and blobs? I really want to use HTML_AJAX with blob but seems blobs don’t get passed. Do you think this will work?
Thanks
Ron