Greeting, I would like to append some div after correct success is returned from my $.post My code looks as follows:
$.post("/MyApp/Market/CheckIfIndustryIsValid", { id: $(NODE).attr("id") },
function(obj) {
if (obj.Success) {
if ($.inArray($(NODE).attr("id"), array) === -1) {
array.push($(NODE).attr("id"));
$("#Industries").val(array);
arrayOfNames.push($(NODE).attr("title"));
$("#SelectedIndustries").html($(NODE).attr("title"));
}
else {
array.splice(array.indexOf($(NODE).attr("id")), 1);
$("#Industries").val(array);
arrayOfNames.splice(array.indexOf($(NODE).attr("title")), 1);
$("#SelectedIndustries").val(arrayOfNames);
$("#resultMessage").append($(NODE).attr("title"));
}
}
else {
alert("Please choose different industry"); //failure, show message
}
However these lines:
$("#SelectedIndustries").val(arrayOfNames);
$("#resultMessage").append($(NODE).attr("title"));
are not working. For test purposes I also added some alert("test") just before these two lines and it has been executed. Can someone please help.