javascript - How to add 12 to a string? -


hi have string contains url in below

http://www.myurl.com/abc/asdd/asd/rwewe/saaa/all-makes?expanded=no&s=true&searchlimit=12&searchoffset=24

i storing url in js string below

var backtosearch = $(location).attr('href'); //typeof(backtosearch);  

i want add 12 searchoffset , set cookie mycookie.

$.cookie('mycookie', backtosearch , {  path: '/' }); 

when 12 added

http://www.myurl.com/abc/asdd/asd/rwewe/saaa/all-makes?expanded=no&s=true&searchlimit=12&searchoffset=36

how add 12 string?

how about;

url = url.replace(/searchoffset=(\d+)/, function(a, b) {     return "searchoffset=" + (parseint(b, 10) + 12); }) 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -