Show More
@@ -217,25 +217,13 b' function resetForm(form) {' | |||||
217 | form.find('input:text, input:password, input:file, select, textarea').val(''); |
|
217 | form.find('input:text, input:password, input:file, select, textarea').val(''); | |
218 | form.find('input:radio, input:checkbox') |
|
218 | form.find('input:radio, input:checkbox') | |
219 | .removeAttr('checked').removeAttr('selected'); |
|
219 | .removeAttr('checked').removeAttr('selected'); | |
220 |
$(' |
|
220 | $('.file_wrap').find('.file-thumb').remove(); | |
221 | } |
|
221 | } | |
222 |
|
222 | |||
223 |
|
223 | /** | ||
224 | $(document).ready(function(){ |
|
224 | * When the form is posted, this method will be run as a callback | |
225 | initAutoupdate(); |
|
225 | */ | |
226 |
|
226 | function updateOnPost(response, statusText, xhr, form) { | ||
227 | // Post form data over AJAX |
|
|||
228 | var threadId = $('div.thread').children('.post').first().attr('id');; |
|
|||
229 |
|
||||
230 | var form = $('#form'); |
|
|||
231 | var options = { |
|
|||
232 | success: updateOnPost, |
|
|||
233 | url: '/api/add_post/' + threadId + '/', |
|
|||
234 | }; |
|
|||
235 |
|
||||
236 | form.ajaxForm(options); |
|
|||
237 |
|
||||
238 | function updateOnPost(response, statusText, xhr, $form) { |
|
|||
239 |
|
|
227 | var json = $.parseJSON(response); | |
240 |
|
|
228 | var status = json.status; | |
241 |
|
229 | |||
@@ -257,4 +245,21 b' function resetForm(form) {' | |||||
257 |
|
|
245 | } | |
258 |
|
|
246 | } | |
259 | } |
|
247 | } | |
|
248 | ||||
|
249 | $(document).ready(function(){ | |||
|
250 | initAutoupdate(); | |||
|
251 | ||||
|
252 | // Post form data over AJAX | |||
|
253 | var threadId = $('div.thread').children('.post').first().attr('id');; | |||
|
254 | ||||
|
255 | var form = $('#form'); | |||
|
256 | ||||
|
257 | var options = { | |||
|
258 | success: updateOnPost, | |||
|
259 | url: '/api/add_post/' + threadId + '/' | |||
|
260 | }; | |||
|
261 | ||||
|
262 | form.ajaxForm(options); | |||
|
263 | ||||
|
264 | resetForm(form); | |||
260 | }); |
|
265 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now