I have a problem or Error with JSON

-1

Good afternoon I have a problem with JSON and I do not know how to correct

I call the function in this way

function mostrar(idgrado){ 
  $.post("../ajax/grados.php?op=mostrar",{idgrado:idgrado}, fun‌​ction(data,status){ 
     data= JSON.parse(data); 
     mostrarfomr(true); 
     $("#nombregrado").val(data.nombregrado); 
     $("#idgrado").val(data.idgrado); 
   }) 
} 

The data comes from an sql query

I enclose an image please help me

    
asked by luis gonzalez 13.11.2017 в 19:34
source

1 answer

0

you are receiving two parameters function (a, b) success and you are only converting one, why do you have two parameters and are you only sending one parameter? so it should be with a parameter

echo json_encode($respuesta);


function (data) {
  data = JSON.parse(data) 

}

He also checks the network if he brings information about your arrangement

    
answered by 13.11.2017 в 19:59