So I move my code to the new sln, apparently it's not working for the new one. I have this method to go to another page.
JS
function Create() {
debugger;
State = "create";
UrlPartialView = '@Url.Content("~/ChecklistMonitoring/Create/")';
LoadPartialViewData(UrlPartialView, function (data) {
debugger;
DivContentBody.style.display = 'none';
DivFormBody.innerHTML = data;
@* $('#TanggalSearch').datepicker({
todayHighlight: true,
format: "MM yyyy",
viewMode: "months",
minViewMode: "months",
autoclose: true,
language: "id"
});
$('#PeriodeTahunSearch').datepicker({
todayHighlight: true,
format: "yyyy",
viewMode: "years",
minViewMode: "years",
autoclose: true,
language: "id"
});*@
DropdownDataSektorEkonomiServerSide('SektorEkonomiId', 50, false);
DropdownDataDGMServerSide('Dgmid', 50, false);
LoadWizzard();
ValidationPopupInfoDebitur();
//LoadContentFormEWS();
//Informasi Debitur
DropdownSektorEkonomi('SektorEkonomiId', 10, true);
DropdownDGM('Dgmid', 10, true);
//NANTI DI COMMEND
//LoadContentFormEWS();
$('input:radio:first').attr('checked', true);
});
}
and this is one of the example of the fucntion used above, the rest is kinda the same.
function DropdownDGM(elementId, jumlahRowPerPage, isMultiple) {
debugger;
var dropdownKurs = $("#" + elementId).select2({
ajax: {
url: '@Url.Action("GetAllDataDGM", "Utility")',
dataType: 'json',
delay: 250,
multiple: isMultiple,
allowClear: true,
data: function (params) {
return {
q: params.term, // search term
page: params.page || 1,
rowPerPage: jumlahRowPerPage
};
},
processResults: function (data, params) {
//debugger
params.page = params.page || 1;
return {
results: data.items,
pagination: {
more: (params.page * jumlahRowPerPage) < data.total_count
}
};
},
cache: true
},
placeholder: '-Silahkan pilih-',
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
minimumInputLength: 0
//templateResult: formatRepoPegawai
});
var select2Instance = $('#' + elementId).data('select2');
select2Instance.on('results:message', function (params) {
this.dropdown._resizeDropdown();
this.dropdown._positionDropdown();
});
}
And this is the controller for the JS
public ActionResult Create()
{
if (!lastSession.Update())
{
return RedirectToAction("Login", "Account");
}
var idpegawai = HttpContext.Session.GetString(SessionConstan.Session_Pegawai_Id);
CreateInfoDebitur_ViewModels ewsFormInfoDebitur = new CreateInfoDebitur_ViewModels();
ewsFormInfoDebitur.Crcid = int.Parse(HttpContext.Session.GetString(SessionConstan.Session_Pegawai_Id));
ViewBag.NamaPegawai = HttpContext.Session.GetString(SessionConstan.Session_Nama_Pegawai);
ViewBag.PegawaiId = HttpContext.Session.GetString(SessionConstan.Session_Pegawai_Id);
var url = ConfigDataAccess.Configuration["baseApiInboxInputer"] + ConfigDataAccess.Configuration["urlapi:InboxInputer:ViewCreate"];
(bool resultApi, string result) = RequestToAPI.PostRequestToWebApi(url, new { }, HttpContext.Session.GetString(SessionConstan.jwt_Token));
var jsonResult = JsonConvert.DeserializeObject<ServiceResult<Dropdown_GetById_VM>>(result);
ViewBag.Kuartal = jsonResult.Data.kuartalList.Items;
ViewBag.TrafficLight = jsonResult.Data.trafficLight.Items;
ViewBag.AccountStrategy = jsonResult.Data.accountStrategy.Items;
return PartialView("_Create", ewsFormInfoDebitur);
}
I got error jquery.min.js:2 Uncaught Error: Syntax error, unrecognized expression: # in the console. It worked on the other project idk why. any solution?