0

I'm getting a warning that stops my program from working. I have a simple form that is controlled by a jQuery AJAX POST. It was working until today, and I think it has to do with the fact that I download jQuery from a CDN. I'm getting this warning:

event.returnValue is deprecated. Please use the standard event.preventDefault() instead. 

I have changed my script src to the latest from the jQuery website as well. Even though this is just a warning, it has broken my application. Nothing happens when I submit the form. Here is code if necessary:

AJAX

$.ajax({
        url: url,
        type: type,
        data: data,
        contenType:'application/json; charset=utf-8',
        dataType:'json',
        success: function(response){
            if(response.allClear==1){
                window.location = "http://localhost/ServerObserver/dashboard.html";
            }
            else if(response.allClear==0){
                console.log("[loc.W]: Wrong username or password.");
            }
            else{
                console.log("[loc.E]: Something went terribly wrong.");
            }
        }

    });

PHP Validation (Really basic, I know!)

<?php
include 'dbcon.php';

if(isset($_POST['text_login_username'],$_POST['text_login_password']))
{
    header('Content-Type: application/json');
    $loginResult=array();
    $dbcon=getConnection();
    $userName=mysqli_real_escape_string($dbcon, $_POST['text_login_username']);
    $password=mysqli_real_escape_string($dbcon, $_POST['text_login_password']);
    $loginQuery="SELECT * FROM userData WHERE userName='$userName' AND userPassword='$password'";
    $queryResult=mysqli_query($dbcon, $loginQuery);
    $legalRows=$queryResult->num_rows;

    if($legalRows==1)
    {
        setcookie("currentUser", $userName);
        $loginResult['allClear']=1; 
    }
    else
    {
        $loginResult['allClear']=0;
    }

    echo json_encode($loginResult);

}



?>

Like I said before, I'm pretty sure the problem is because of the version of the latest version of jQuery, so any solutions would be much appreciated!

Tats_innit
  • 33,991
  • 10
  • 71
  • 77
Carpetfizz
  • 8,707
  • 22
  • 85
  • 146

0 Answers0