jQuery Ajax无法在Windows XP上调用MVC 3 Controller方法 [英] jQuery Ajax failing to call to MVC 3 Controller method on Windows XP
问题描述
我正在从按钮单击视图调用我的MVC 3控制器方法的Ajax调用。通过给出错误"未找到对象",Ajax方法失败。在Windows XP上部署时会发生这种情况。在Windows 7上不会发生这种情况。在两天没有任何帮助的情况下,这个问题我被困在
这个问题上。任何帮助将非常感激。这是我的代码。
Hi i am invoking a Ajax call to my MVC 3 controller method from a view on button click. Ajax method fails by giving the error "Object not Found". This happens when it is deployed on Windows XP. It does not happen on Windows 7. I am stuck up on this issue from Two days with no help. Any help would be much appreciated. Here is my code.
DisplayAttributes.cshtml
DisplayAttributes.cshtml
function DisplayFullImage()
{
var model = {
ChoosenColor: sendDesignerData,
TotalDensity: TotalPixelFilled
};
var urls = '@Url.Action("GetColors","Designer")';
$.ajax({
type: 'POST',
url: urls,
data: JSON.stringify(model),
success: function (data) { },
dataType: "json",
contentType: "application/json; charset=utf-8",
error: function (Response, Status, Error) { alert("Response: " + Response + " Status: " + Status + " Error: "+Error); }
})
}
function Generate()
{
//Some code to fill sendDesignerData and TotalPixelFilled
DisplayFullImage();
}
DesignerController.cs
public class DesignerController : Controller
{
//
// GET: /Designer/
public ActionResult DisplayAttributes()
{
return View();
}
[HttpPost]
public void GetColors(DesignColors DsgColor)
{
if (DsgColor.ChoosenColor != null && DsgColor.TotalDensity > 0)
{
Session["Colors"] = DsgColor;
}
else
{
List<Colors> DummyColors = new List<Colors>();
DsgColor.ChoosenColor = DummyColors;
DsgColor.TotalDensity = 0;
Session["Colors"] = DsgColor;
}
}
}
在按钮上单击Generate()方法,我将填充Json对象
" sendDesignerData"使用一些值并将数值赋给
"TotalPixelFilled"变量,然后调用DisplayFullImage()
On button click Generate() method is called and i fill an Json object "sendDesignerData" with some values and also assign numeric value to "TotalPixelFilled" variable and then call DisplayFullImage()
应用程序在Windows 7上部署时工作,并且不能在
Windows XP上运行。 Ajax调用失败,我收到错误"未找到对象"在
警报。
The application work when deployed on Windows 7 and does not work on Windows XP. The Ajax call fails and i get error "Object Not Found" in alert.
提前致谢
推荐答案
嗨Ezhirko,
Hi Ezhirko,
请在 $中发布您的问题b $ b ASP.NET论坛,您可以获得更多帮助。
Please post your question in ASP.NET forums where you could get more help.
感谢您的理解。
这篇关于jQuery Ajax无法在Windows XP上调用MVC 3 Controller方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!