kendo mobile json data calling problem

2 posts, 0 answers
  1. Sajid
    Sajid avatar
    6 posts
    Member since:
    Mar 2012

    Posted 16 Apr 2012 Link to this post

     i have written a code for taking json data from a php and putting to listview ,it works great in localhost ,
    when i put the php file in a webserver and called in javascript it showing eeror and not getting data.

    this method i have  used 
     var dataSource = new{
                    transport: {
                        read: {
                           //url: "userchk.php",    //this works in localhost  
                           url: "",  this is not working 
                            dataType: "json",
                            data: { 
                                q: "javascript"

    first url data is geting in localhost and works great, second url is not working(but data showing  if we run the url in a browser)

    it show Error

    XMLHttpRequest cannot load Origin http://localhost is not allowed by Access-Control-Allow-Origin.

    waiting for a good response
  2. Johan
    Johan avatar
    3 posts
    Member since:
    Dec 2011

    Posted 08 May 2012 Link to this post

    This is due to the basic security restrictions in browsers.
    With JSON you can only use the "only phone home" principle.
    If your JSON service is e.g. then your mobile app must be on the same domain e.g.

    See Additional notes on jQuery.ajax()

Back to Top