sherbug1015
asked on
Jquery - parsing the results returned from webmethod
I have a jquery that executes a stored proc and returns all the teams a user is a member of and also it returns the teams that have the search term a user entered.
Here is my jquery
$(document).ready(function (){
$('div.TUButton').click(fu nction() {
var searchingfor = $('#searchterm').val()
$.ajax({
type: "POST",
url: "/CMSPages/WebService.asmx /TeamUpSea rchResults ",
data: JSON.stringify({ searchterm: searchingfor}),
contentType: "application/json",
success: function (data) {
// Do something on sucess
},
error: function(jqXHR, status, errorThrown) {
// Do something on failure
}
});
});
});
here is a sample of what gets returned
<string><div class="groupID" data-groupname="HumanResou rces">
<div class="teammember" data-teammember="True">
</div>
</div>
</string>
The UI has a setup like the attached. In this example I would want to parse out the data-groupname where data-teammember = True and put a checkbox next to the group.
Can someone help me with how to parse this inside my jquery.
Thanks in advance
Here is my jquery
$(document).ready(function
$('div.TUButton').click(fu
var searchingfor = $('#searchterm').val()
$.ajax({
type: "POST",
url: "/CMSPages/WebService.asmx
data: JSON.stringify({ searchterm: searchingfor}),
contentType: "application/json",
success: function (data) {
// Do something on sucess
},
error: function(jqXHR, status, errorThrown) {
// Do something on failure
}
});
});
});
here is a sample of what gets returned
<string><div class="groupID" data-groupname="HumanResou
<div class="teammember" data-teammember="True">
</div>
</div>
</string>
The UI has a setup like the attached. In this example I would want to parse out the data-groupname where data-teammember = True and put a checkbox next to the group.
Can someone help me with how to parse this inside my jquery.
Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.