Monday, March 19, 2012

Pass all the Form elements to call JSON

If you call any server file on the live server to get json data, then may be you need to transfer some variables with value. for ex. if you need to insert data to your server then you must haveto post all data to server file.

First you need to follow my previous blog(get-data-using-cross-domain-request).

Create one form element and create all the variable into the form tag that you want to post on the server.
Create below function in the .js file.

function createQuery(fname)
     var formname= fname;
     var elements = document.getElementById(formname).elements;
     var pairs = new Array();
var next_el = "";
var checkdetail=""
    for (var i = 0; i < elements.length; i++)

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 = '' + encodeURIComponent('select * from html where url="' + site + '"') + '&format=xml&callback=?';
  $.getJSON( yql, cbFunc);

  function cbFunc(data) {
     if ( data.results[0] ) {

Saturday, March 3, 2012

Getting Started Phonegap with Android eclipse

Here is the steps that I follow to start a phonegap using android eclipse.
Refer the below link to configure the android eclipse and Sdk setup on your computer.

don't Forget to setup the environment variable for the java, android, SDK and ant-home.
My Computer-->properties-->advance parameters