I have seen most of the post regarding this but I can't seem to find the correct resolution.
I have 2 Solution, Bioman and PowerRangers, both have a Code Module , a javascript gets trigger on dropdownlist change to load a table (as shown below)
BIOMAN uses Ajax to get data using Index Action on CodesController
function ajaxCall(obj) {
var retdata = {};
$.ajax({
dataType: "json",
type: "POST",
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(obj),
async: false,
processData: false,
cache: false,
success: function (data) {
retdata = data;
},
error: function (xhr) {
alert("error");
}
});
return retdata;
}
Then calls a javascript to load the table
function drawCodesTable(codes) {
var sHTML = [];
if (codes == null) return;
if (codes.length > 0) {
$("#dvCreateMenu").css("display", "");
sHTML.push("<table class='table'>")
sHTML.push("<thead>");
sHTML.push("<tr>");
sHTML.push("<th>Code Id</th>");
sHTML.push("<th>Code Name</th>");
sHTML.push("<th>Code Display</th>");
sHTML.push("<th>Code Group</th>");
sHTML.push("<th>Active Ind</th>");
sHTML.push("<th>Action</th>");
sHTML.push("</tr>");
sHTML.push("</thead>");
sHTML.push("<tbody>");
for (var x = 0; x < codes.length; x++) {
sHTML.push("<tr>");
sHTML.push("<td>" + codes[x].CodeId + "</td>");
sHTML.push("<td>" + codes[x].CodeName + "</td>");
sHTML.push("<td>" + codes[x].Display + "</td>");
sHTML.push("<td>" + codes[x].CodeGroupName + "</td>");
sHTML.push("<td>" + codes[x].ActiveInd + "</td>");
sHTML.push("<td>");
sHTML.push("<a code_id=" + codes[x].CodeId + " class='btn btn-primary btn-xs' action='edit'>Edit</a>");
sHTML.push(" <a code_id=" + codes[x].CodeId + " class='btn btn-danger btn-xs' action='delete'>Delete</a>");
sHTML.push("</td>");
sHTML.push("</tr>");
}
sHTML.push("</tbody>");
sHTML.push("</table>")
}
}
POWERRANGERS calls the load function and calls a Load Action from CodesController which then returns a Partial View to load the same table structure
This is the View Structue of POWERRANGERS
$("#dvCodes").empty()
.load("/Codes/Load?id=" + $(this).val() + "×tamp=" + new Date().getTime());
BIOMAN works fine on both local Network and outside Network.
However, when POWERANGER is access outside Network the dropdownlist items shows which means that database is accessible from View but it doesn't render the table on the Partial View, Here are the error I got on different browsers
Chrome
Internet Explorer