Cannot Call Ajax Method in Windows Phone 7 using PhoneGap

拈花ヽ惹草 提交于 2019-12-06 23:42:42

PROBLEM SOLVED!!!!

I just had to add $.support.cors = true; before $.ajax call. The problem was I was posting information to a WebService from cross-platform.

Following is the code:

$.support.cors = true;
    $.ajax({
                    type: "POST",
                    url: create_user,
                    data: JSON.stringify(make),
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (result) {
                        window.location = "Login.html";
                    },
                    error: function (error) {
                        $("#alert").show();
                        document.getElementById('alert').innerHTML = "<b>Connection Failed!</b> Please Check Your Configurations";
                    }
                });

I don't if that's good practice or not but it helped me. Have fun coding.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!