Reputation: 3038
Using an ajax call I have returned the partialView HTML of a page, but before I display it I wish to pull information from the main div. This data is just size information, for if I create a floating window.
Code:
<div class="window-details" data-height="500px" data-width="500px">more data here</div>
this.PopUp = function (url, title) {
$.ajax(url)
.success(function (partialViewHtml) {
var partialViewDom = $(partialViewHtml);
var thisDiv = $(".window-details", partialViewDom);
I can see the data in chromes debugger when hovering over partialViewDom, but the class selection does not appear to have worked. Any clues? Does it not parse correctly? Thanks.
Upvotes: 2
Views: 112
Reputation: 95056
Try using the .filter()
instead, most likely your .window-details
element is a top level element in the dom fragment.
var thisDiv = partialViewDom.filter(".window-details");
Upvotes: 2
Reputation: 28154
Your code searches for elements with the .window-details
in the children of the div that was returned.
Upvotes: 0