Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function(){
- $('#search .dropdown-menu li a').on('click', function(e){
- e.preventDefault();
- var $this = $(this),
- thisText = $this.text().trim(),
- changedText = $this.closest('.dropdown-menu')
- .siblings('.dropdown-toggle')
- .first();
- $('#searchType').val(thisText);
- changedText.text( 'по ' + thisText );
- });
- //Функция отпраки данных
- $('#search').on('submit', function(e){
- var selfSer = $(this).serialize();
- e.preventDefault();
- $.ajax({
- data : selfSer,
- url : '/test/',
- type : 'GET',
- dataType : 'json',
- statusCode: {
- 400: function() {
- alert("Bad Request");
- },
- 500: function() {
- alert("Internal Server Error");
- }
- }
- }).done(function(data){
- console.log(data);
- }).fail(function(jqXHR, textStatus){
- console.log('Ошибка запроса: ' + textStatus);
- });
- console.log(selfSer);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement