开发者

How to use jQuery to extract a URL parameter from a string

i hat one task, and know i have to continue but have a bad experience with regexp ... :(

can somebody help me :

i need to take a sting from "domain url" with jquery :

This is the address name :

http://mydomain/Our-Company/default.aspx?txt=James D. Perrlo

I want to take with jquery la string after "?txt=" in this case "James D. Perrlo"

PS: 开发者_开发技巧This string always is ends of the url

Can somebody help me ?

Thanks !


This small URL plugin lets you do this:

var url = $.url('http://allmarkedup.com/folder/dir/index.html?item=value');
url.attr('protocol'); // returns 'http'
url.attr('path'); // returns '/folder/dir/index.html'

https://github.com/allmarkedup/jQuery-URL-Parser


/.+\?(.[^&]+)/ should do the trick.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜