[wp-trac] [WordPress Trac] #30638: Missing dataType in Customizer Widgets

WordPress Trac noreply at wordpress.org
Sat Dec 13 03:30:29 UTC 2014


#30638: Missing dataType in Customizer Widgets
-------------------------------+------------------------------
 Reporter:  iseqqavoq          |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Customize          |     Version:  4.0.1
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  javascript
-------------------------------+------------------------------

Comment (by westonruter):

 Well I cannot reproduce the problem. If I go into the Customizer and edit
 a widget, an Ajax request gets kicked off with the request headers
 including:

 {{{
 POST /wp-admin/admin-ajax.php HTTP/1.1
 Accept: */*
 Content-Type: application/x-www-form-urlencoded; charset=UTF-8
 ...
 }}}

 And the response headers (note the `Content-Type`):

 {{{
 HTTP/1.1 200 OK
 Server: nginx
 Date: Sat, 13 Dec 2014 03:18:20 GMT
 Content-Type: application/json; charset=UTF-8
 Transfer-Encoding: chunked
 Connection: keep-alive
 X-Powered-By: PHP/5.5.9-1ubuntu4.4
 Access-Control-Allow-Origin: http://src.wordpress-develop.dev
 Access-Control-Allow-Credentials: true
 X-Robots-Tag: noindex
 X-Content-Type-Options: nosniff
 Expires: Wed, 11 Jan 1984 05:00:00 GMT
 Cache-Control: no-cache, must-revalidate, max-age=0
 Pragma: no-cache
 X-Frame-Options: SAMEORIGIN
 }}}

 The response body is a well-formed JSON document:

 {{{#!json
 {"success":true,"data":{"form":"\t\t<p><label for=\"widget-
 calendar-25-title\">Title:<\/label>\n\t\t<input class=\"widefat\" id
 =\"widget-calendar-25-title\" name=\"widget-calendar[25][title]\"
 type=\"text\" value=\"test!\"
 \/><\/p>\n","instance":{"encoded_serialized_instance":"...","title":"test!","is_widget_customizer_js_value":true,"instance_hash_key":"..."}}}
 }}}

 And if patch `customize-widgets.js` as follows:

 {{{#!diff
 @@ -1017,6 +1017,7 @@
                         jqxhr = $.post( wp.ajax.settings.url, data );

                         jqxhr.done( function( r ) {
 +                               console.info( typeof r, r );
                                 var message, sanitizedForm,
 $sanitizedInputs, hasSameInputsInResponse,
                                         isLiveUpdateAborted = false;
  }}}

 Then I see in my console that `r` is an object and it is properly parsed.

 Please share the same details about your environment so we can identify
 where the problem lies.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30638#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list