简体   繁体   English

动态CRM:CRM 2013中的Jquery $ ajax错误

[英]Dynamic CRM : Jquery $ajax error in CRM 2013

I have added button in command bar with the help of "Ribbon workbench". 我已经在“ Ribbon workbench”的帮助下在命令栏中添加了按钮。

And this button is calling javascript method, code as below: 并且此按钮正在调用javascript方法,代码如下:

/// <reference path="new_/Scripts/jquery_1.9.1.js" />
function callPotentialDuplicateService()
    {
        $.ajax({
            type: "POST",
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            url: 'http://*******.svc/MethodName',
            success: function (data) {
                result = data.Result;
                alert(result);

            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert("Err")
                alert(XMLHttpRequest.status);
            }
        });
    }

Now when i try this same in Visual studio, it is working fine. 现在,当我在Visual Studio中尝试同样的方法时,它工作正常。 but in CRM its not working. 但在CRM中无法正常工作。

How should i add jQuery-1.9.1.js file in above method. 我应该如何在上述方法中添加jQuery-1.9.1.js文件。

You need to add the jQuery script file as part of the action and make the command isNaN. 您需要将jQuery脚本文件添加为操作的一部分,并使命令为isNaN。

Include jQuery in the command before you include your custom script file. 在包含自定义脚本文件之前,请在命令中包含jQuery。

See point number 6 on this blog 请参阅此博客上的第6点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM