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

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -