I have the following XML which is returned to me after making an AJAX request.
<entry xml:base="url" xmlns="http://www.w3.org/2005/Atom"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<id>URL</id>
<category term="SomeCategory" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"></category>
<link rel="edit" title="Table" href="Table(56)">
<link rel="SomeURL" type="application/atom+xml;type=entry" title="table" href="table(56)/table1">
<link rel="SomeURL" type="application/atom+xml;type=entry" title="table" href="table(56)/table2">
<link rel="SomeURL" type="application/atom+xml;type=feed" title="table" href="table(56)/table3">
<link rel="SomeURL" type="application/atom+xml;type=entry" title="table" href="table(56)/table4">
<title></title>
<updated>2016-01-16T02:35:51Z</updated>
<author>
<name></name>
</author>
<content type="application/xml">
<m:properties>
<d:NewlyCreatedId m:type="Edm.Int32">56</d:NewlyCreatedId>
</m:properties>
</content>
I'm trying to get the value 56 out of it using jQuery, this is my success method inside my AJAX method:
success: function (data) {
var selectedId = data.find('d:NewlyCreatedId').val();
alert(selectedId);
}
But this produces the error:
Uncaught TypeError: data.find is not a function
Can someone suggest how I go about pulling the value our of this XML document please.
* Update *
I've tried that was suggested in the answers, however this is now returning null where I alert the selectedId.
Inside my success method I now have this:
var selectedId = $(data).find('d\\:NewlyCreatedId').text();
Updated the question with the complete XML document
* update *
I've been battling this all day, I changed my datatype within my ajax method to xml, tried looping through but with no avail. Can someone shed some light on this?