jquery - SCRIPT5009: 'URLSearchParams' is undefined in IE 11 -


sorry, if have repeated question.

i trying execute urlsearchparams function in jquery got error on ie 11 while working in chrome , mozilla. it's not supported in ie11. let me know how can make supportive ie. executing code in laravel 5.4.

i did research not solution.

here line of code try execute.

var urlparams = new urlsearchparams(window.location.search);

error:

script5009: 'urlsearchparams' undefined

thanks in advance.

got solution replacing code given example:

$.urlparam = function(name){     var results = new regexp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);     if (results==null){        return null;     }     else{        return decodeuri(results[1]) || 0;     } } 

example.com?param1=name&param2=&id=6

$.urlparam('param1'); // name $.urlparam('id');        // 6 $.urlparam('param2');   // null 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -