Advertisement
Avatarr

url

Aug 10th, 2014
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. initComponent: function() {
  2.  
  3. this.callParent();
  4. var queryString = {};
  5. var strurl;
  6.  
  7. strurl = document.location.href.split('?');
  8.  
  9. var tmp = strurl[1].split("&");
  10.  
  11. for ( var i = 0; i < tmp.length; i++) {
  12. var pair = tmp[i].split("=");
  13.  
  14. // If first entry with this name
  15. if (typeof queryString[pair[0]] === "undefined") {
  16. queryString[pair[0]] = pair[1];
  17. // If second entry with this name
  18. } else if (typeof queryString[pair[0]] === "string") {
  19. var arr = [ queryString[pair[0]], pair[1] ];
  20. queryString[pair[0]] = arr;
  21. // If third or later entry with this name
  22. } else {
  23. queryString[pair[0]].push(pair[1]);
  24. }
  25. }
  26.  
  27. var extension;
  28. var agent_number;
  29. var agent_name;
  30.  
  31. extension = queryString["extension"];
  32. agent_number = queryString["agent_number"];
  33. agent_name = queryString["name"];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement