parsing - how to parse with jquery the id from a uri like http://beta.domo.md/ro/smartphones/159-philips-s388-android.html (id=159)? -


how parse jquery id url

"http://beta.domo.md/ro/smartphones/159-philips-s388-android.html" (id=159)

or

"/ro/smartphones/159-philips-s388-android.html" ?

i think help, try it:

var url="http://beta.domo.md/ro/smartphones/159-philips-s388-android.html"; var url1=url.substring(url.lastindexof("/")+1); var id=url1.substring(0, url1.indexof("-")); 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -