hi
I need to retrieve values of sharepoint list with jquery
I invoke jquery:ajax call for following type of site
http://localhost:port/site/devsite/_vti_bin/list.asmx
in Processaresult function I dont get any rows but list is having two rows
I checked the webservice by adding web reference then i got the error.
Document type is not recognized as valid .
Is this bcoz of above error?
var soapEnv = " \ \ testlist \ \ \ \ \ \ \ \ \ \ \ \ \ \ TRUE \ \ \ \ \ ";
// call this SOAP request every 20 seconds $("#tasksUL").everyTime(20000,function(i){ // our basic SOAP code to hammer the Lists web service $.ajax({ url: "http://ourdomain.net/_vti_bin/lists.asmx", type: "POST", dataType: "xml", data: soapEnv, error: printError, complete: processResult, contentType: "text/xml; charset=\"utf-8\"" }); }); });
// basic error display that will pop out SOAP errors, very useful! function printError(XMLHttpRequest, textStatus, errorThrown) { alert("There was an error: " + errorThrown + " " + textStatus); alert(XMLHttpRequest.responseText); }
// main method that will cycle through the SoAP response nodes function processResult(xData, status) {
$(xData.responseXML).find("z\:row").each(function() --->here i dont get values of list { // resets display element $("#tasksUL").empty();
// gets attachments array - if there is more than one attachment, // they get seperated by semi-colons in the response // they look like this natively (just an example): // ows_Attachments = ";#http://server/Lists/Announcements/Attachments/2/test.txt; // #http://server/Lists/Announcements/Attachments/2/UIP_Setup.log;#"
var mySplitResult = $(this).attr("ows_Attachments").split(";");
// set up storage for later display of images var notice_images = "";
// processes attachments - please forgive the kludge!
for(i = 0; i < mySplitResult.length; i++)
{
// check to see the proper link URL gets chosen
if (i % 2 != 0 && i != 0)
{
// strips out pound sign
mySplitResult[i] = mySplitResult[i].replace("#", "");
// (possibly redundant) check to make sure element isn't simply a pound sign
if (mySplitResult[i] != "#")
{
// adds an img tag to an output container
notice_images = notice_images + "<img src='" + mySplitResult[i] + "' border='0' align='right' style='float:right;' /><br />";
}
} }
// create final output for printing var liHtml = "
" + $(this).attr("ows_Title") + "
" + notice_images + $(this).attr("ows_Body") + "
";// assign output to DIV tags $("#tasksUL").html(liHtml);
});
}