Internet Explorer를 사용하여 제대로 작동하는 MVC5 응용 프로그램이 있지만 Chrome을 사용하려고하면 오류가 발생하고 "오류 ". 나는 다른 방법으로이 만든 또한Google 크롬을 사용하여 ClientSide에서 ServerSide로 데이터를 전송하는 중 문제가 발생했습니다.
var priv = 0;
if ($("#EsPrivado").is(":checked")) {
priv = 1;
}
$.ajax({
type: "POST",
url: "/Tickets/Guardar",
data: "{'RutEmpresa': '" + $("#RutEmpresa").val() + "', " +
"'CPID': " + $("#CPID").val() + ", " +
"'ContactoID': " + $("#ContactoID").val() + ", " +
"'AreaEmpresaID': " + $("#AreaEmpresaID").val() + ", " +
"'TipoEventoID': " + $("#TipoEventoID").val() + ", " +
"'FechaInicio': '" + $("#FechaInicio").val() + "', " +
"'Descripcion': '" + $("#Descripcion").val() + "', " +
"'EsPrivado': " + priv + ", " +
"'xLatitud': " + latitud + ", " +
"'xLongitud': " + longitud + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) { onGuardarOK(msg); },
error: function (ajaxresult, status) { onError(ajaxresult, status); }
});
하고 문제는 동일합니다 : : 여기
내 자바 스크립트 코드이 내 서버 방법의 정의입니다var priv = 0;
if ($("#EsPrivado").is(":checked")) {
priv = 1;
}
var nticket = {
RutEmpresa: $("#RutEmpresa").val(),
CPID: $("#CPID").val(),
ContactoID: $("#ContactoID").val(),
AreaEmpresaID: $("#AreaEmpresaID").val(),
TipoEventoID: $("#TipoEventoID").val(),
FechaInicio: $("#FechaInicio").val(),
Descripcion: $("#Descripcion").val(),
EsPrivado: priv,
xLatitud: latitud,
xLongitud: longitud
};
$.ajax({
type: 'POST',
contentType: "application/json;charset=utf-8",
url: '/Tickets/Guardar',
dataType: 'json',
data: JSON.stringify({ nticket: nticket }),
traditional: true,
success: function (msg) { onGuardarOK(msg); },
error: function (ajaxresult, status) { onError(ajaxresult, status); }
});
:
public ActionResult Guardar(string RutEmpresa, long CPID, long ContactoID, int AreaEmpresaID,
int TipoEventoID, string FechaInicio, string Descripcion,
int EsPrivado, double xLatitud, double xLongitud)
그리고, 다른 방법으로 그것을 정의
public ActionResult Guardar(Models.clsTicket nticket)
wath가 오류의 원인 일 수 있습니까?
는 이제 CONTROLER가 객체 인 myObject를 기대한다data: JSON.stringify({ nticket: nticket }),
data: "{'myObject':" + JSON.stringify(nticket) + "}",
에
컨트롤러 작업도 제공하십시오. –
Firefox에서 시도하고 Firebug를 사용하여 가능한 오류를 디버그하는 데 도움이 되었습니까? –
"오류"는 어디에 있습니까? JS 콘솔에서? 아니면 AJAX 요청의 응답 본문에서? –