如何显示查找结果

时间:2014-01-10 10:37:42

标签: javascript jquery

我使用jQuery.AJAX从其他页面获取html,然后使用jQuery.find()查找特定的div。我试图输出它但没有显示任何内容,但是当我在console.log()它时,我得到了

[prevObject: e.fn.init[187], context: undefined, selector: ".updateform", jquery: 

"1.10.2", constructor: function…]
context: undefined
length: 0
prevObject: e.fn.init[187]
[0 … 99]
0: text
baseURI: null
childNodes: NodeList[0]
data: "↵↵    "
firstChild: null
lastChild: null
length: 6
localName: null
namespaceURI: null
nextElementSibling: title
nextSibling: title
nodeName: "#text"
nodeType: 3
nodeValue: "↵↵    "
ownerDocument: document
parentElement: null
parentNode: document-fragment
prefix: null
previousElementSibling: null
previousSibling: null
textContent: "↵↵    "
wholeText: "↵↵    "
__proto__: Text
1: title
2: text
3: link
4: text
5: link#buttons-css
6: text
7: link#dashicons-css
8: text
9: link#media-views-css
10: text
11: link#thickbox-css
12: text
13: link#wp-color-picker-css
14: text
15: link#acf-global-css
16: text
17: link#acf-input-css
18: text
19: link#acf-datepicker-css
20: text
21: link#acf-input-repeater-css
22: text
23: link#bootstrapcss-css
24: text
25: script
26: text
27: script
28: text
29: script
30: text
31: script
32: text
33: script
34: text
35: script
36: text
37: script
38: text
39: script
40: text
41: script
42: text
43: script
44: text
45: script
46: text
47: script
48: text
49: script
50: text
51: script
52: text
53: link
54: text
55: link
56: text
57: link
58: text
59: meta
60: text
61: link
62: text
63: link
64: text
65: script
66: text
67: link
68: text
69: header
70: div.updateform
71: hr
72: text
73: footer
74: text
75: script#tmpl-media-frame
76: text
77: script#tmpl-media-modal
78: text
79: script#tmpl-uploader-window
80: text
81: script#tmpl-uploader-inline
82: text
83: script#tmpl-uploader-status
84: text
85: script#tmpl-uploader-status-error
86: text
87: script#tmpl-attachment
88: text
89: script#tmpl-attachment-details
90: text
91: script#tmpl-media-selection
92: text
93: script#tmpl-attachment-display-settings
94: text
95: script#tmpl-gallery-settings
96: text
97: script#tmpl-embed-link-settings
98: text
99: script#tmpl-embed-image-settings
[100 … 186]
length: 187
__proto__: Object[0]
selector: ".updateform"
__proto__: Object[0]
 (index):359

JS CODE:

jQuery('document').ready(function() {
                jQuery('.update').click(function() {
                    console.log('Update ID: ' + jQuery(this).parent().parent().attr('data-id'));

                    var request = $.ajax({
                        url: jQuery(this).parent().parent().attr('data-themeurl') + '/get-update-form/',
                        type: "POST",
                        data: { id : jQuery(this).parent().parent().attr('data-id') },
                        dataType: "html"
                    });

                    request.done(function( msg ) {
                        jQuery('.updateform').html(jQuery(msg).find('.updateform'));
                        console.log(jQuery(msg).find('.updateform'));
                    });

                    request.fail(function( jqXHR, textStatus ) {
                        console.log( "Request failed: " + textStatus );
                    });
                });
            });

如何将此数据输出到网页?

0 个答案:

没有答案