Код: Выделить всё
$.post('/gruop/add', $('#form_id').serialize(), function(data) {
// then the code will be executed at the end of the query
// data - response, which returned to the server
});
как отправить обычный post и вернуть json?
Код: Выделить всё
$.postJSON('/gruop/add', $('#form_id').serialize(), function(data) {
мне из формы нужно отправить длинный текст порядка 20 000 - 40 000 символов
и всего 4 параметра и их я не вижу смысла ставить в json всего 4 параметра для отправки в скрипт...
Код: Выделить всё
$.postJSON = function(url, data, callback) {
return jQuery.ajax({
'type': 'POST',
'url': url,
'contentType': 'application/json',
'data': $.toJSON(data),
'dataType': 'json',
'success': callback
});
};
как красиво отправить обычной post и вернуть json чтобы его перебрать?