MVC 5 + $邮报()函数不工作对托管服务器后, [英] MVC 5 + $Post() function not working after hosted on server
问题描述
我已经开发了MVC5的应用程序。下面code查看一个环节的onclick被调用 -
I have developed an application in MVC5. Onclick of a link on the View below code gets invoked -
// Code in View File
$.post('../ControllerName/FunctionName', //this is your url
{
id: image,
}, function (data) {
alert("Successfully published");
}
).error(function () {
alert("Failed to publish");
});
//Code in Controller
[HttpPost]
public void ISPPDF(string id)
{}
这是我面临的问题是,当我通过视觉studio.However运行它后,我对托管服务器上我的应用程序似乎不调用该函数的ISPPDF()函数被调用。
Issue that i am facing is the ISPPDF() function gets invoked when i run it through visual studio.However after i hosted my application on server it does not seem to call the function..
我觉得有一些问题,与我所指定的路径 -
I feel there is some issue with the path i have specified -
我也尝试指定路径下面的方法,但没有运气!
i also tried specifying path the below ways but no luck!
/ControllerName/FunctionName
ControllerName/FunctionName
任何帮助将是AP preciated。
Any help would be appreciated.
谢谢,
推荐答案
试试这个作为你的帖子的方法是在视图文件
Try this as your post method is in view file
$后('../ FunctionName',{ID:图片,},功能(数据){警报(成功发布);})错误(函数(){警报(无法发布。 );});
$.post('../FunctionName',{ id: image,}, function (data) { alert("Successfully published");}).error(function () {alert("Failed to publish"); });
这篇关于MVC 5 + $邮报()函数不工作对托管服务器后,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!