- $.ajax({
- type : 'POST',
- url : ajaxurl,
- data : post,
- success : function(x) { findPosts.show(x); spinner.hide(); },
- error : function(r) { findPosts.error(r); spinner.hide(); }
- });
- },
-
- show : function(x) {
-
- if ( typeof(x) == 'string' ) {
- this.error({'responseText': x});
- return;
- }
-
- var r = wpAjax.parseAjaxResponse(x);
-
- if ( r.errors ) {
- this.error({'responseText': wpAjax.broken});
- }
- r = r.responses[0];
- $('#find-posts-response').html(r.data);
+ $.ajax( ajaxurl, {
+ type: 'POST',
+ data: post,
+ dataType: 'json'
+ }).always( function() {
+ spinner.hide();
+ }).done( function( x ) {
+ if ( ! x.success ) {
+ $( '#find-posts-response' ).text( attachMediaBoxL10n.error );
+ }