サイトの読み込みに問題があります。このコードの使用:
$.ajax({
type: "POST",
//url: '@Url.Action("/TellFriendPopup")',
url: '/Property/TellFriendPopup',
data: { "SenderName": SenderName, "senderMail": senderMail, "receiverMail": receiverMail, "comments": comments, "urlLink": urlLink, "subjectId": subjectId },
success: function (data) {
$("#result").html("<ul><li>Name: " + data.nameret + "</li><li>Email: " + data.emailret + "</li><li>Message: " + data.messageret + "</li></ul>");
$(".dialog").dialog("close");
},
問題は、MVC4ビューではなく、JavaScriptファイルにコードを移動する必要があったことです。このファイルで@Url.Action
メソッドを使用できます。ただし、JavaScriptでは機能しません。それは私にこのエラーを与えるだけですPOST http://localhost:54717/Property/ContactPopup 404 (Not Found)
。私が見ることができる理由は、それが欠けているのはグローバリゼーションだからです。URLは次のようになります http://localhost:54717/da/Property/ContactPopup
か http://localhost:54717/en/Property/ContactPopup