javascript - TypeError: $.url is not a function -


i having javascript file named _report_js.html.erb file under app/views/reports. when run application, getting error:

typeerror: $.url not function

this code:

<script type="text/javascript">     if($.url().param('ig') == 'true') {       alert("hi");       $('#icons').hide();       $('#photos').show();     end </script> 

$.url()  

is not part of jquery core. if want achieve similiar, maybe use

var geturlparameter = function geturlparameter(sparam) {     var spageurl = decodeuricomponent(window.location.search.substring(1)),         surlvariables = spageurl.split('&'),         sparametername,         i;      (i = 0; < surlvariables.length; i++) {         sparametername = surlvariables[i].split('=');          if (sparametername[0] === sparam) {             return sparametername[1] === undefined ? true : sparametername[1];         }     } }; 

to use it:

var tech = geturlparameter('technology'); 

in example this

if(geturlparameter('ig') == 'true') { 

source


Comments

Popular posts from this blog

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

testing - Detect whether test has failed within fixture -

android - Create single AAR file from multiple modules using Gradle -