-1
Good morning, you guys. I got a problem.
I set up a function to bring some results in the Onchange of a select via ajax
The problem is that this 'Qtde' input is printing the following msg [OBJECT OBJECT]
Who can tell me what’s wrong??
follows the code =>
function setqtde(obj)
{
var item = obj.value;
$.ajax({
url:BASE_URL+"estoque/pegaqtde",
type:'GET',
data:{valor:item},
dataType:'json',
success:function(json)
{
document.getElementById("qtde").value = json;
}
});
}
json is an object. You have to use
json.campo
where field is the property that contains the quantity– William John Adam Trindade
It depends on jQuery’s content, it depends on what he did with the bakc-end, it depends on a lot of things to get the slightest sense of how to help you, until now it’s impossible/impossible to imagine the origin of the problem, I just tell you, the URL is returning a JSON as an answer and JSON cannot be printed as a string directly and it is not what you want, you clearly want something from the specific json, but the way this question is not able to guess anything. So give details.
– Guilherme Nascimento