Perhaps you can spot something I cannot:
This is my code
if(jQuery.urlParam('returnview')) {     
    var ret = jQuery.urlParam('returnview');
    var iid = jQuery.urlParam('iid'); 
    window.location = 'index.php?option=mycomponent&view='+ret+'&Itemid='+iid+'&lang=en';
} else  if(!jQuery.urlParam('returnview')){
  window.location = 'index.php?option=mycomponent&view=myview&Itemid=380&lang=en&sent=1'; 
} else {
  alert('something is dodge');
}
and this is the function:
jQuery.urlParam = function(name){
   var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
   return results[1] || 0;
}
Now, if there is a 'returnview' defined in my 'from' URL, it works fine. However, if there is no returnview defined, it should go to the second case or even if that fails, throw an alert.
Can anyone see anything obvious I am doing wrong here?
Thanks
Jacques
 
     
     
     
     
     
    
window.locationand paste what it drops. – ex3v Mar 19 '13 at 09:58