I need to ask a quick question and probably a dumb question since I'm new to JQuery anyway why isn't this script working? It looks fine but isn't doing anything do i need to call the functions in the HTML some how?

            <input type="text" name="user_login" id="user_login">
             <input type="password" name="user_pass" id="user_pass">

             <td><input type="checkbox" name="remember_me" id="remember_me"> </td><td>Remember Me For 2 Days</td>

          <tr id="button_box">
             <td><input type="button" name="submit" value="Sign In" class="button" onclick="check(e)"></td>
          <tr><td colspan="2" id="flash"></td></tr>



$(document).ready(function () {
   // Make a function that returns the data, then call it whenever you
   // need the current values
   function getData() {
       return {
           user_login: $('#user_login').val(),
           pass_login: $('#user_pass').val()


   function loading(e) {
       $('#content').html('Loading Data');

   function clearfields() {
       $('#user_login').val('');  //Clear the user login id field
       $('#pass_login').val('');  //Clear the user login password field        

   function check(e) {

           url: 'ajax/check.php',
           type: 'post',
           error: function () {
               //If your response from the server is a statuscode error. do this!!!
           beforeSend: function () {
           data: { user_login: $('#user_login').val(), pass_login: $('#pass_login').val() }, // get current values
           success: function (data) {
               //if your response is a plain text. (e.g incorrect username or password)

               if (data.indexOf("incorrect username or password") > -1) {





   // Don't repeat so much; use the same function for both handlers
   $('#field').keyup(function (e) {
       if (e.keyCode == 13) {
           var username = $('#user_login').val();


   $('#submit').click(function (e) {
       if (e.keyCode != 13) {



No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top