View Single Post
Old 01-30-2012, 11:17 AM   PM User | #5
jackvan
New Coder

 
Join Date: Jan 2012
Posts: 24
Thanks: 1
Thanked 1 Time in 1 Post
jackvan is an unknown quantity at this point
How to send data value to a script

Thanks, it works!

I want to send username data entered in the Form to a script which will then check the database for username availability. I've trouble getting it work.

Here's what I did:
PHP Code:
var name = $("#name");
$.
ajax({
    
url:"/cgi-bin/isaccount.cgi?name.val()",
    
async:false,
    
success:function(data){

        if(
data=="no"){
            
alert("name ok");

        }
        if(
data=="yes") {
            
alert("Name In Use");
        }
        return 
true;
        }

The intention is to send the value of name to the script, isaccount.cgi for it to check username availability. It does not work because the value of name.val() is not passed to the script isaccount.cgi.

I don't think removing the " " in the following line will work:
url:"/cgi-bin/isaccount.cgi?name.val()",

Kindly advise how to do it.

Thanks.
jackvan is offline   Reply With Quote