Jakob Plenge Jakob Plenge - 4 months ago 14x
Javascript Question

jQuery Ajax call not working in IE, JSON respond not getting through

I am trying to make an ajax call with a json respond to work in IE, but nothing is happening. It is currently working fine in other browsers.

I have read a lot of places, that there are some general issues with ajax and IE, but none of the solutions have helped.

I have also tried using the $.ajaxSetup({ cache: false }); but that doesn't fix it, it does not seem to have anything to do with caching.

Any help i highly appreciated.

The code is pasted under.


$(document).on("submit", ".loginForm", function(event) {


var url=$(this).attr("action");
url: url,
type: 'POST',
data: new FormData(this),
processData: false,
contentType: false,
datatype: "json",
success: function (data, status)
if(data.success == "success"){
} else {
$('#loginResponse').html(data.success).css("color", "red").fadeIn().delay(2000).slideToggle();



header("Content-Type: application/json", true);

if(isset($_POST['submit_login'])) {

$username = $_POST['username'];
$password = $_POST['password'];

$sql = 'SELECT user_id, first_name, password FROM arbor_admin_users WHERE username=?';

$stmt = $connection->prepare($sql);
$stmt->bind_param('s', $username);
$stmt->bind_result($uid, $fn, $pwhash);
if($stmt->num_rows > 0) {

// if ($password === $pw) {
if (password_verify($password, $pwhash)) {
$_SESSION['logged_in'] = $uid;
$_SESSION['firstname'] = $fn;
// header("Location: ../dashboard.php");
echo json_encode(array('success'=>"success"));

} else {

echo json_encode(array('success'=>"Wrong username or password!"));

} else {
echo json_encode(array('success'=>"Wrong username or password!"));


After a long time debugging, i found out that

    data: new FormData(this),

doesn't include the submit button in IE, but does in all other browsers.

So to fix it, i just removed:

  if(isset($_POST['submit_login'])) {

and problem solved :)