javascript - How can I set an if the query string is does come up as something other than -
how can make javascript if function if query string show other undefined. here code:
var getquerystring = window.location.href.split("?")[1]; alert(getquerystring);
basically wanted if function in javascript. here code:
if (getquerystring = 1){ //add code }
how can set javascript function?
the bellow code should work you
var getquerystring = window.location.href.split("?")[1]; if (typeof getquerystring !== 'undefined') { //your code goes here } else [ alert("query string not set"); }
Comments
Post a Comment