I noticed I can't embed inline javascript in an SPO 2013 Web Part page, but can reference a library.
I'm outputting a table from that js. If I put alerts that table displays but then disappears once the code proceeds.
Any way to do this without jsrender?
Suspect the table needs to be in the embedded markup code.
This is a function in a jquery library i reference in SiteAssets.
$.ajax({
url: 'https://xxxx/SearchValues/' ,
data: 'SearchData=' + searchData,
type: 'GET',
dataType: 'json',
// jsonp: 'jsonp-callback',
success: function (data) {
// alert("before write response");
WriteResponses(data);
},
error: function (x, y, z) {
alert(x + '\n' + y + '\n' + z);
}
});
//Display results in a table
function WriteResponses(SitesList) {
var strResult = "<table border='1px'><th width='20px'>ID</th><th width='100px'>TITLE</th><th
width='100px'>FARM</th><th width='250px'>URL</th><th width='100px'>OWNERS</th><th width='200px'>ADMINISTRATORS</th>";
$.each(SitesList, function (index, oSite) {
strResult += "<tr><td>" + oSite.LS_ID + "</td><td> " + oSite.LS_TITLE + "</td><td>" + oSite.LS_FARM +
"</td><td>" + oSite.LS_SITE_URL + "</td><td>" + oSite.LS_OWNERS + "</td><td>" + oSite.LS_ADMINISTRATORS + "</td></tr>";
});
strResult += "</table>";
$("#divResult").html(strResult);
alert(strResult);
}
}
function WriteResponses(SitesList) {
var strResult = "<table border='1px'><th width='20px'>ID</th><th width='100px'>TITLE</th><th width='100px'>FARM</th><th
width='250px'>URL</th><th width='100px'>OWNERS</th><th width='200px'>ADMINISTRATORS</th>";
$.each(SitesList, function (index, oSite) {
strResult += "<tr><td>" + oSite.LS_ID + "</td><td> " + oSite.LS_TITLE + "</td><td>" + oSite.LS_FARM + "</td><td>" +
oSite.LS_SITE_URL + "</td><td>" + oSite.LS_OWNERS + "</td><td>" + oSite.LS_ADMINISTRATORS + "</td></tr>";
});
strResult += "</table>";
$("#divResult").html(strResult);
}