Guest User

cross doamin

a guest
Feb 19th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1.  
  2. function getCategory(pincode){
  3. var URL = 'http://www.popcracker.com/pincode-api/pincode.php?';
  4. $.ajax({
  5. url:URL,
  6. data:{'id':id},
  7. dataType:'json',
  8. type:'POST',
  9. beforeSend:function(){ $('#'+divId+'_loader').html('<img src="loading.gif">');},
  10.  
  11. success:function(data){
  12. var pincode=getParameterByName('pincode');
  13. function getParameterByName(name) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); }
  14. complete:function(){
  15.  
  16. setTimeout(function(){
  17. $('#'+divId+'_loader').html('');
  18. },1000)
  19. },
  20. error: function(xhr,status,error) { alert('Error: ' + status) ; }
  21. });
  22. }
  23. getCategory(0,'main_cat_div','maincat');
  24.  
  25. $('#maincatId').live('change',function(){
  26. $('#sub_cat2_div').html();
  27. var id = $(this).val();
  28. getCategory(id,'sub_cat_div','subcat1');
  29. });
  30.  
  31. $('#subcat1Id').live('change',function(){
  32. var id = $(this).val();
  33. getCategory(id,'sub_cat2_div','subcat2');
  34. });
  35.  
  36. });
Advertisement
Add Comment
Please, Sign In to add comment