jquery中Get方法请求接口
Posted siyunianhua
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jquery中Get方法请求接口相关的知识,希望对你有一定的参考价值。
$.ajax( { url: ‘http://192.168.1.85:8080/api/Code/GetCodeProductInfo‘, type: ‘GET‘, beforeSend: function (request) { request.setRequestHeader("Token", "8D8433968E1B4052B9963C91EB8B581A"); }, dataType: ‘text‘, data: { code: $("#packCode").val() }, success: function (data) { data = eval(‘(‘ +data+ ‘)‘); console.log(data.data); if (data.code == 200) { $("#product_code").text(codeUrl); $("#register_code").text(data.data.registerCode); $("#generic_name").text(data.data.genericName); $("#shap").text(data.data.shap); $("#production_style").text(data.data.productionType); $("#production_date").text(data.data.productionDate); $("#production_batch").text(data.data.batchNo); $("#fit_crop").text(data.data.fitCrop); $("#description").text(data.data.description); $("#entName").text(data.data.entName); } }, error: function (data) { console.log("error"); } } ); });
以上是关于jquery中Get方法请求接口的主要内容,如果未能解决你的问题,请参考以下文章
react中向后台服务器发送一请求 后台接口返回的是byte[]类型的图片 我现在如何在前台界面中显示它?
如何向网站提交一个get 请求 ; 网站的方法接口然后返回一个对象?