Archive for October, 2011

How to enable Ajax loading of External URL(Cross Domain) in Jquery Mobile especially in Phonegap?

I am not quite sure how many of you had faced this is issue. But it was real a pain in the ass. I am was searching and searching but no use. Finally  I decided to rewrite what they wrote. Then the shocking surprise in the code that,  it was well documented so it was so easy . And my answer/issue was is already  answered.

Kidus to Jquery Mobile team for the fantastic work.

 

Continue reading →

Wish you all a happy and safe Deepavali

Wish you all a happy and safe Deepavali

 

 

 

 

 

 

 

 

 

 

 

 

Wish you all a happy and safe Deepavali

Javascript Replace All method

While working on my latest project requirement I found a strange issue in basic Javascript. replace method is not replacing all occurrence of the search key, it just replacing the first occurrence.

Synatx
string.replace(regexp/substr,newstring)
But

   var teststring = 'test test string';
    teststring .replace('test','test2');

will give you only ‘test2 test string’ not the expected one ‘test2 test2 string‘.

In order to get expected result we must  userregular expressions as below

var teststring = 'test test string';
teststring .replace(/test/g,'test2');

which will give u ‘test2 test2 string

Continue reading →