javascript - Ajax call does not invoked the controller -
The code is using the following code to make the call to action, and I have an Internet Server Error 500 I see, the path looks fine, what could be the problem. The value of entry is 1 ...
Here is the AJAX call
$. Ajax ({type: 'POST', url: "../ .. / user / deleted confirmation", Data type: "Jason", Content type: "Application / Jason; Charset = UTF-8", data : 'Id =' + entry id});
Here is the controller action code. [Http post, action name ("deleted confirmation")] Public Jasonstadt deleted confirmation (id) {..
is error
Posts https://127.0.0.1/User / Deleted Confirm 500 (Internal Server Error) jquery-2.1 1.js: 8623 jQuery Ajaxtransport.send jquery-2.1.1.js: 8623 jQuery.extend.ajax jquery-2.1.1.js: 8152 (anonymous function) Index: 519 jQuery.event.dispatch jquery-2.1.1.js: 4409 jQuery.event .add.elemData.handle
You are not creating your data < / Code> Property right: You are sending a string like
id = 3
, which can not be parsed as JSON so that you get a server error.
So you just have to fix your data: You need to crate an object with the actions of the parameter's parameter names and to change it to the appropriate JSON string, JSON The stringify
method must be used:
$ .ajax ({type: 'post', url: "../../user/DeleteConfirmed", datatype: "Jason ", Content Type:" Application / Jason; Charset = utf-8 ", Data: JSON.stringify ({id: entryId}}});
Comments
Post a Comment