Window.location= sending two calls to that URLs GET method

Important lesson learnt today (which ate my last 5 hours).. Consider an ajax code like this $.ajax({ type : "POST", url : "<url to hit>" success : function(response) { window.location='/cart'; }, error : function() { return false; } });   The objective of this code is to hit a particular url, on receiving success from …

Advertisements

Canada zip code format regex

Effective regular expression to validate Canada zip code format : String regex = "^(?!.*[DFIOQU])[A-VXY][0-9][A-Z] ?[0-9][A-Z][0-9]$"; Pattern pattern = Pattern.compile(regex); if(!pattern .matcher("postcode").matches()) {         System.out.println("This is CA zip code"); }