Create function to calculate distance. and pass lat long of first place and second place. and one parameter for the distance type.
function calculateDistance($lat1,$lng1,$lat2,$lng2,$miles = true)
{
$pi80 = M_PI / 180;
$lat1 *= $pi80;
$lng1 *= $pi80;
$lat2 *= $pi80;
$lng2 *= $pi80;
My Blog contain Phonegap,CMS related posts. Here I am posting the issues solution that I faced while development and its difficult to find proper solution on other sites. I hope my post will help you with your issues. Developer rocks.
Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts
Friday, April 12, 2013
Friday, January 25, 2013
Access-Control-Allow-Origin. issue on Phonegap JqueryMobile
When i ajax call to get or post some Data from Server, Some times I found error like below.
to Solve above error write below syntax in your device ready function.
XMLHttpRequest cannot load file://localhost/Users/bhumika/Documents/phonegap-2.2.0/lib/ios/bin/****/www/js/data.json. Origin null is not allowed by Access-Control-Allow-Origin.
to Solve above error write below syntax in your device ready function.
$.support.cors = true;
$.mobile.allowCrossDomainPages = true;
Or
Write Below syntax in PHP file to the server.
Or
Write Below syntax in PHP file to the server.
header('Access-Control-Allow-Origin: *');
Cheers....
Cheers....
Labels:
android,
cordova,
cross-domain,
form elements,
ios,
iphone,
javascript,
jQuery,
jQuerymobile,
json,
post data,
web,
xcode,
xml
Tuesday, September 25, 2012
Mobile website not fit to the screen.
Open the Html file and write below code in the first line.
For Mobile site:
If Doctype is already exist like below then replace it.
For Desktop site.
Saturday, March 10, 2012
Get Data using Cross-Domain Request
There is a two methods to get data from the url. one is XML and second is the Json. the xml methods is very complicated and large. that's why I started to use json format for the cross-domain request.
Create cross_domain.js file
function requestCrossDomain( site, callback ) {
if ( !site ) {
return false;
}
var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="' + site + '"') + '&format=xml&callback=?';
$.getJSON( yql, cbFunc);
function cbFunc(data) {
if ( data.results[0] ) {
Create cross_domain.js file
function requestCrossDomain( site, callback ) {
if ( !site ) {
return false;
}
var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="' + site + '"') + '&format=xml&callback=?';
$.getJSON( yql, cbFunc);
function cbFunc(data) {
if ( data.results[0] ) {
Subscribe to:
Posts (Atom)