This is a migrated thread and some comments may be shown as answers.

Data Source not returning data

3 Answers 87 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Imran
Top achievements
Rank 1
Imran asked on 05 Jan 2016, 10:57 AM

Hi ,

 

I have created simple app which is having login page username & password . and also i have api which return id,name as json format.

one more thing day before yesterday same was working properly. but wen i tried today its not working.

every time it is error function is executing.

please help me sovle this problem, here is my code as follow

login:

<div data-role="view" data-title="Home View" data-layout="main" data-model="app.home" data-show="app.home.onShow" data-after-show="app.home.afterShow">
    <div class="signin-view">
        <form>
            <ul data-role="listview" data-style="inset">
                <li>
                    <label>Email
                        <input type="email" id="email" required autofocus>
                    </label>
                </li>
                <li>
                    <label>Password
                        <input type="password" id="password" required>
                    </label>
                </li>
            </ul>
            <div class="button-group button-group-vertical">
             
                <a class="primary" data-role="button" id="btnlogin">click</a>
            </div>
        </form>
    </div>
   
        </form>
    </div>
    <div class="offline" align="center" style="display:none;">
        You are currently offline. Before using this app in offline mode you must initialize it while you are online
    </div>
    <!-- START_CUSTOM_CODE_homeModel -->
    <!-- Add custom code here. For more information about custom code, see http://docs.telerik.com/platform/screenbuilder/troubleshooting/how-to-keep-custom-code-changes -->
    <!-- END_CUSTOM_CODE_homeModel -->
    <!-- START_CUSTOM_CODE_home -->
    <!-- Add custom code here. For more information about custom code, see http://docs.telerik.com/platform/screenbuilder/troubleshooting/how-to-keep-custom-code-changes -->
    <!-- END_CUSTOM_CODE_home -->
    <script type="text/javascript">
        $('#btnlogin').click(function () {
                   
                       var username = $('#email').val();
                       var password = $('#password').val();
            alert(email+","+password);
                    $.ajax({
                            url: "http://www.mivbvpn.com:8040/api/users?",
                            data: {
                                Username: username,
                                Password: password
                            },
                            type: "get",
                            dataType: "json",
                            success: function (data) {
                                alert("data:");
                            },
                            error: function (xhr, data) {
                                alert(xhr.statusText);
                            }
                    });
        });
    </script>
</div>

3 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 06 Jan 2016, 04:05 PM
Hi Imran,

Without looking at the error we can't tell you what can be wrong. To start with, is it a JavaScript error from your source or an error from your API? Can you copy the error message?

Regards,
Tsvetina
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Imran
Top achievements
Rank 1
answered on 12 Jan 2016, 04:31 AM

Hi Tsvetina ,

 thank you for reply, the error is what i am getting is as follow:

XMLHttpRequest cannot load http://www.mivbvpn.com:8040/api/users. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://app.icenium.com' is therefore not allowed access. The response had HTTP status code 405.

 

0
Tsvetina
Telerik team
answered on 14 Jan 2016, 11:22 AM
Hello Imran,

Can you confirm that the endpoint at http://www.mivbvpn.com:8040/api/users accepts cross-domain requests? Check this Stack Overflow thread answer for more information:

Getting request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource

Regards,
Tsvetina
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Imran
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Imran
Top achievements
Rank 1
Share this question
or