html – ajax returning json data as undefined
when i run below code.
it makes error and alert “fail error:StntaxError: Unexpected token < in JSON at position 0 data:undefined”
what is the problem ??
$("#a").click(function(){
st_dt = $('#st_dt').val();
end_dt = $('#end_dt').val();
lot_cd = $('#lot_cd').val();
var obj = {"st_dt":st_dt,"end_dt":end_dt,"lot_cd":lot_cd}
var json_1 =JSON.stringify(obj)
$.ajax({
type: 'POST',
url: '{{ url_for("get_operid") }}',
data: json_1,
dataType: 'JSON',
success: function(data) {
alert("Successn"+data);
},
error: function(request, status, error,data) {
alert("failn"+"error:"+error+"n data:"+data);
}
});
})
Read more here: Source link