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

kendo mobile json data calling problem

1 Answer 96 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Sajid
Top achievements
Rank 1
Sajid asked on 16 Apr 2012, 06:47 AM
Hi,
 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 kendo.data.DataSource({
                transport: {
                    read: {
                     
                       //url: "userchk.php",    //this works in localhost  
                       url: "http://example.com/web/userchk.php",  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 http://example.com/web/userchk.php?q=javascript. Origin http://localhost is not allowed by Access-Control-Allow-Origin.

waiting for a good response

1 Answer, 1 is accepted

Sort by
0
Sajid
Top achievements
Rank 1
answered on 16 Apr 2012, 07:29 AM
hi,

i have solved , works great

solution is :
add php header like this 

header('Access-Control-Allow-Origin: *');
Tags
Data Source
Asked by
Sajid
Top achievements
Rank 1
Answers by
Sajid
Top achievements
Rank 1
Share this question
or