1. var newPath = window.location.pathname;
  2. alert(newPath);
  3. var res = newPath.search(/pageCounter=-?(\d)/i);
  4. if(res == -1){
  5. newPath = newPath . "&pageCounter="+postData.pageCounter;
  6. }else{
  7. newPath = newPath.replace(/pageCounter=-?(\d)/i , "i");
  8. }