Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. function selChange(sel) {
  2. if (!isFirstLevel()) { return }
  3. $.ajax({
  4. type: "POST",
  5. url: 'http://example.com/ajax_refill',
  6. data: {'category': sel.val() },
  7. dataType:'json',
  8. success: function(data) {
  9.  
  10. var select = $("#select"), options = '';
  11. select.empty();
  12.  
  13. for(var i=0;i<data.length; i++)
  14. {
  15. options += "<option value='"+data[i].id+"'>"+ data[i].name +"</option>";
  16. }
  17.  
  18. select.append(options);
  19. }
  20. });
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement