weixin_33713707 2015-07-28 14:11 采纳率: 0%
浏览 38

Ajax和Mobilefirst

I tried now Ajax with mobilefirst to invoke business rules i tried this in my main.js file inside a button click handler:

   $.ajax({
          type: "POST",
          url: "https://brsv2-0cc90e37.ng.bluemix.net/DecisionService/rest/vacationsRuleApp/164.0/vacationsRuleProject/1.0",
          async: false,
          withCredentials: true,
          headers: {Authorization: "Basic " + "credentials"},
          data: {
"employeeID": "anything",
"loanAmount": 2320,
"theEmployee": {
    "seniority": 3,
    "annualSalary": 10517320,
    "nbOfExtraVacationDaysBasedOnSeniority": 10517320
        },
"creditAmount": 20000,
"__DecisionID__": "string",
"AnnualSalary": 20000
        }
         }).done(function(response) {
             alert("Success");
           alert(JSON.stringify(response)); // if you're into that sorta thing


         }).fail(function(response) {
               alert("Fail");

               alert(JSON.stringify(response)); // if you're into that sorta thing

            });

then i tried to get the error and i found this from the json.stringify(response):

NetworkError: Failed to execute 'send' on 'XMLHttpRequest':Failed to load 'https://brsv2-0cc90e37.ng.bluemix.net/DesicionService/rest/vacationsRuleApp/164.0/vacationsRuleProject/1.0.

and when i inspectelement on my chrome browser i find this error:

XMLHttpRequest cannot load https://brsv2-0cc90e37.ng.bluemix.net/DecisionService/rest/vacationsRuleApp/164.0/vacationsRuleProject/1.0. No 'Access-Control-Allow-Origin' header is present on the requested resource

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥30 如何降低hdfs中datanode的JVM内存用量
      • ¥15 Android URL如何转成视频/音频,可行吗?
      • ¥20 SQL数据查询,子查询
      • ¥15 c++字符串分割问题
      • ¥15 vue+uniapp
      • ¥15 android freedom
      • ¥15 关于STM32的SPI和ENDAT接口编码器通信的问题
      • ¥15 关于#pdfbox#生成的PDF文件正常,转图片中文乱码的问题,如何解决?
      • ¥15 ADS中有关DAC控件的使用问题
      • ¥15 win11如何运行geoserver