Hi,
I am working on hybrid application and I have created login page and I am passing params username & password to api,
but ia mgetting following error:
“No 'Access-Control-Allow-Origin' header is present on the requested resource.
I found solution for that from stackoverflow
http://stackoverflow.com/questions/20035101/no-access-control-allow-origin-header-is-present-on-the-requested-resource
but still I am not able to data
my code is as follow:
<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" data-bind="value: homeModel.email" required autofocus>
</label>
</li>
<li>
<label>Password
<input type="password" id="password" data-bind="value: homeModel.password" required>
</label>
</li>
</ul>
<div class="button-group button-group-vertical">
<a data-role="button" class="primary" data-bind="events: { click: homeModel.signin }">Sign In</a>
<a data-role="button" data-bind="events: { click: homeModel.toggleView }">Register</a>
<a class="primary" data-role="button" id="btnlogin">click</a>
</div>
</form>
</div>
<div class="signup-view" style="display:none;">
<form>
<ul data-role="listview" data-style="inset">
<li>
<label>Email
<input type="email" data-bind="value: homeModel.email" required>
</label>
</li>
<li>
<label>Password
<input type="password" data-bind="value: homeModel.password">
</label>
</li>
<li>
<label>Name
<input type="text" data-bind="value: homeModel.displayName">
</label>
</li>
</ul>
<div class="button-group button-group-vertical">
<a class="primary" data-role="button" data-bind="events: { click: homeModel.register }">Register</a>
<a data-role="button" data-bind="events: { click: homeModel.toggleView }">Sign In</a>
</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(username + "," + password);
$.ajax({
url: "http://www.mivbvpn.com:8040/api/users?",
data: {
Username: username,
Password: password
},
type: "get",
dataType: "jsonp",
success: function (result) {
alert(result.FullName);
},
error: function (xhr, result) {
alert(xhr.status);
}
});
});
</script>
</div>
when I run application I am getting status 200 as screen attached.
please help me to solve this issue.
thank you