I getting this error when my $.ajax line runs.

Uncaught TypeError: Illegal invocation jquery.min.js:4

e jquery.min.js:4

Vc jquery.min.js:4

Vc jquery.min.js:4

Vc jquery.min.js:4

m.param jquery.min.js:4

m.extend.ajax jquery.min.js:4

ajaxFunction NewHost.php:231

validateInput NewHost.php:324

onclick NewHost.php:114

As far as I know the rest of the script works.

I'm changing from using vanilla ajax to jQuery and ajax. The ajax call was adapted from a separate page that did work.

The URL, data, and success attributes were changed to match the page needs.

The line that fires the error is $.ajax({ I know that means that the whole function has a problem.

Here is the non working function

function ajaxFunction(){

var Fname = document.getElementById("FName").value;

var Lname = document.getElementById("LName").value;

var BirthDate = document.getElementById("BirthDate").value;

var email = document.getElementById("email").value;

var Pass = document.getElementById("Pass").value;

$.ajax({

url: "ProHost.php",

data: { FName:Fname, LName:LName, BirthDate:BirthDate, Email:email, Pass:Pass },

type: "GET",

//cache: false,

async:false,

success : function (result) {

console.log("Request sent");

var result=trim(result);

$("#demo").hide();

if(result == 'correct'){

console.log(result);

location.assign("/e-Party/HostAcountPage.php");

}else{

console.log(result);

$("#demo").html("You are now registered $FName $LName , please sign-in ");

}

}

});

}

here is the working call:

var Email = document.getElementById("Email").value;

var Pass = document.getElementById("Pass").value;

console.log( Email + '| | ' + Pass);

$.ajax({

url: "Process.php",

data: { Email:Email, Pass:Pass },

type: "POST",

//cache: false,

async:false,

success : function (result) {

console.log("Request sent");

var result=trim(result);

$("#flash").hide();

if(result == 'correct'){

//console.log(result);

location.assign("/e-Party/HostAcountPage.php");

}else{

console.log(result);

$("#errorMessage").html(result + " New Host?");

}

}

});

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐