我有一个调用 JSON API 的脚本文件,我需要发送当前登录用户名作为调用的一部分。我尝试了以下方法:-
$(document).ready(function () {
var name = prompt("Please enter your packageid", "test");
var fullurl = 'http://localhost:8080/jw/web/json/workflow/process/list?j_username=kermit&hash=9449B5ABCFA9AFDA36B801351ED3DF66&loginAs=' + HttpContext.Current.User.Identity.Name + 'packageId=' + name;
$.ajax({
type: "GET",
url: fullurl,
dataType: "JSONP",
success: function (result) {
//code goes here
但它会引发以下错误:- 'HttpContext' 未定义