Topic: Completely new to jQuery trouble with get and post functions

First of all hello to all of you.  I'm new and just getting started with jQuery. 

I watched a few videos and I don't seem to be having any issues with selectors, however when I tried to use some jQuery to submit a form via a <a> tag I'm getting no where.

below is my code I've tried using the GET function and building the complete URL, using the get function and passing data, and using the AJAX function.  No luck.  Can any one point me in the right direction?  I don't HAVE to have the forum submit through the link I would be satisfied using the submit button as well.  I'm just trying to wrap my head around the jQuery AJAX functions.

Thanks a ton,
SMA

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>s3Cart Admin. Landing Page.</title>
<link href="css/reset.css" rel="stylesheet" type="text/css" />
<link href="css/960.css" rel="stylesheet" type="text/css" />
<link href="css/text.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script> 
<script type="text/javascript"> 
 $(document).ready(function(){
 
   $("#formSubmit").click(function() {
     var adminName = $('#adminName').val();
     var adminPass = $('#adminPass').val();
     var baseURL = $('#form').attr('action') + '?'; 
     var ADMIN = 'adminName=' + (adminName) + '&';
      var PASS = 'adminPass=' + (adminPass) + '&submit=Submit' ;
     var formURL = "s3cart/AdminLogin.php?" + ADMIN + PASS;

    //$.get(formURL);
    //$.get(URL, {ADMIN, PASS});
    $.ajax({
        url:formURL,
        type:"get",
        error: alert(formURL),
    });
    
   });
   
}); //End ready Function 
</script>
</head>
<body>
<div class="container_12">
<form action="s3cart/AdminLogin.php" method="get" name="form" id="form">
<div id="error"></div>
<div>Please enter your username <input name="adminName" type="text" id="adminName" value="s3Root" />
</div>
<div>Please enter your password <input name="adminPass" type="text" id="adminPass" value="Ecreator7" />
</div>
<div><input type="submit" name="submit" value="Submit" /></div>
<a href="" id="formSubmit">Click Me</a>
</form>
</body>
</html>

Last edited by sma92878 (February 24, 2009 12:52 pm)

Vote up Vote down