Guest User

Untitled

a guest
Jan 12th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. <select id="domain" name="domain_name" class="form-group form-control">
  2. <option id="first_domain" value="" selected disabled>Alan Adı</option>
  3. <option>Deneme Değeri</option>
  4. <option>Sample Value</option>
  5. <option>Third Sample Value</option>
  6. </select>
  7.  
  8.  
  9. <script>
  10. $('#domain').change(function () {
  11. $.post("www.SITEADRESS.com/post.php", {
  12. authenticity_token: "<%= form_authenticity_token.to_s %>"
  13. })
  14. .done(function (response) {
  15. $('#departments').find('option').not(':first').remove();
  16. response.data.data.forEach(function (element) {
  17. $('#first_department').after("<option value='" + element.id + "'>" + element.name + "</option>");
  18. });
  19. })
  20. .fail(function (xhr, status, error) {
  21. alert("Gönderme İşleminde sorun oluştu, lütfen sistem yöneticiniz ile görüşünüz. Hata Bilgisi: " + error);
  22. });
  23.  
  24. });
  25. </script>
Add Comment
Please, Sign In to add comment