javascript - uncaught referenceerror: is not defined onclick AspNet MVC -


in project need call "save items" function, when click button nothing happens .. , following error: "uncaught referenceerror: savedata not defined      @ htmlanchorelement.onclick (create: 82) " have idea might causing error?

the function:

function salvarpedido() {  var data = $("#data").val(); var valor = $("#valor").val(); var descricao = $("#descricao").val();  var token = $('input[name="__requestverificationtoken"]').val(); var tokenadr = $('form[action="/pedido/create"] input[name="__requestverificationtoken"]').val();  var headers = {}; var headersadr = {}; headers["__requestverificationtoken"] = token; headersadr["__requestverificationtoken"] = tokenadr;   var url = "/pedido/create";  $.ajax({     url: url     , type: "post"     , datatype: "json"     , headers: headersadr     , data: { id: 0, data: data, valor: valor, descricao: descricao, __requestverificationtoken: token }     , success: function (data) {         if (data.resultado > 0) {             listaritens(data.resultado);         }     }  }); 

}

the html:

div class="form-group">         <div class="col-md-offset-2 col-md-10">              <a href="#" onclick="salvarpedido();"class="btn btn-default">salvar pedido</a>         </div>     </div> 


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -