Re: avascript w/Perl question - Simple for most......
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: avascript w/Perl question - Simple for most......

From: Randy Webb <HikksNotAtHome@aol.com>
Date: Wed Feb 01 2006 - 08:29:43 CET

jshanman said the following on 1/31/2006 9:07 AM:
> Randy Webb wrote:
>> jshanman said the following on 1/30/2006 3:01 PM:
>>> amerar@iwc.net wrote:
>>>> Hi All,
>>>>
>>>> I have a form that uses Javascript to validate some fields. Whe the
>>>> user selects to submit the form with certain values selected, I want to
>>>> be able to execute a Perl script, query the MySQL database to get my
>>>> resuts and return an ALERT box to the user if his form input was
>>>> invalid.
>>>>
>>>> Problem is, I do not want to change the screen. I just want the dialog
>>>> to pop up. I am very good at Perl, but I'm less than a novice at
>>>> Javascript. I was hoping that if someone had an exmple of this, they
>>>> could put it up and explain it to me........
>>>>
>>>> Thanks,
>>>>
>>>> Arthur
>>>
>>> You would need to use XmlHTTPRequest to send all the form fields to a
>>> perl page that can check the input against the database/validation
>>> functions, and either return OK to submit, or return false for a
>>> particular field name/number. This is also known as AJAX.
>>> http://www.w3schools.com/xml/xml_http.asp
>> Why do people continue to make the mistake of thinking that
>> XMLHTTPRequest is the only way to do that? It's not. It is also not the
>> most widely supported way of doing it. One simple solution that comes to
>> mind is to submit a dummy form in a hidden IFrame and read the results
>> back from there.
>
> Your right, its not the only way. Another way is outline in the
> article linked below, which involved appending a child script that is
> generated by a server page.

Yes, and that page doesn't have a real good example of how to load
script files dynamically.

> The author claims that this is more compatible then XmlHTTPRequest,

It is - when coded properly.

> however, it only supports GET requests.

Ayup.

> Interesting technique, at least.
>
> http://www.phpit.net/article/ajax-php-without-xmlhttprequest/

Been doing that new "trick" for several years now.

-- 
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Received on Tue Feb 7 21:29:40 2006