0

I have an input field that contains an URL. If the onchange event fires, there should be a jquery function that extract some values and pass it to another function. The problem is only to extract valus.

Here is the url

https://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Beach&aq=&sll=37.09024,-95.712891&sspn=47.972233,107.138672&vpsrc=6&ie=UTF8&hq=Beach+Hotel,&hnear=South+Wales&t=m&fll=-28.639489,153.610239&fspn=0.026139,0.052314&st=115703629269948245352&rq=1&ev=zi&split=1&ll=-28.5725225,124.52239&spn=0.026139,0.052314&z=15&iwloc=A&cid=4038837565330903688  

I want to exctract the values from parameter latitude and longitude, which are located at &ll=-28.5725225,124.52239.

Please help.

Reporter
  • 3,897
  • 5
  • 33
  • 47
Irfan Ahmed
  • 9,136
  • 8
  • 33
  • 54

1 Answers1

0

No need for jQuery for this.

var loc = "https://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Beach&aq=&sll=37.09024,-95.712891&sspn=47.972233,107.138672&vpsrc=6&ie=UTF8&hq=Beach+Hotel,&hnear=South+Wales&t=m&fll=-28.639489,153.610239&fspn=0.026139,0.052314&st=115703629269948245352&rq=1&ev=zi&split=1&ll=-28.5725225,124.52239&spn=0.026139,0.052314&z=15&iwloc=A&cid=4038837565330903688 ";

loc = loc.split("&ll=")[1];
loc = loc.split("&")[0];
console.log(loc);
Anton
  • 32,245
  • 5
  • 44
  • 54