Hi there.
I'm trying to use Jquery (And jqmodal to do the popup box) to create a php
login box.
so far I have the following:
<html>
<head>
<title></title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jqModal.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#ex1a').jqm();
$('#ex1b').jqm({ajax: 'ajax.html', trigger: 'a.ex1btrigger'});
$('form').submit(function(){
$.ajax({ url: "process.php", type: "POST", data: $.param(
$("#login").formdata()),
success: function(msg){ alert( "Logged in: " + msg ); } });
});
});
</script>
<style type="text/css">
</style>
<link rel="stylesheet" href="jqModal.css" type="text/css" media="screen" />
</head>
<body>
<div id="main" style="width: 400px; margin: auto; border: 1px solid #e5e5e5;
padding: 10px; margin-top: 10px;">
LOGIN (inline), B) view
</div><br>
<div class="jqmWindow" id="ex1a">
Close
<hr>
<form>
Username:<input type="text" id="user" name="user" maxlength="30">
<br/> Password:<input type="password" id="pass" name="pass" maxlength="30">
<input type="submit" value="Login">
</form>
</div>
<div class="jqmWindow" id="ex1b">
Please wait... loading
</div>
My problem is when i press submit on the form, it just throws &user=&pass=
etc etc on the URL of the page. SO it's not submitting via jquery properly.
I want it to send the "user" and "pass" to process.php as a POST value.
Process.php will then check if the login is correct and if it is, return a 1
or a 0(success or fail) but even so I don't know how to use the result with
jquery & then show the correct message like welcome / login failed.
I'd previously been using XAJAX which was actually built for php so it was a
lot easier to do things like login boxes etc.
cheers
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/