You probably want (but see also below):
$('#senurl').click(function () {
$.ajax({
type: "POST",
url: "/Admin/Coupon1/Reject",
dataType: "json",
data: "[email protected]&url=@url"
});
});
...because you have to think about what the browser sees, and if @url gets replaced with Expired by the server, from the error you can tell that what the browser sees for your code is:
data: "id="+2925+"&url="+Expired // <=== What the browser sees with your current code
Even better, let jQuery handle any potential URI-encoding needed by passing it an object instead:
$('#senurl').click(function () {
$.ajax({
type: "POST",
url: "/Admin/Coupon1/Reject",
dataType: "json",
data: {id: @Model.id, url: "@url"}
});
});
If you don't want to pass jQuery an object and let it handle the URI-encoding for you, then you'll want to handle it yourself:
data: "[email protected]&url=" + encodeURIComponent("@url")
Expiredvariable. Is that your complete source code?@urlseems to be replaced byExpired(by the server), which does not seem to be an existing variable. I assume you want to treat it as a string:+"&url=@url".