Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Jquery获取“新数组”JSONP响应中的第一个元素_Jquery_Arrays_Json_Jsonp - Fatal编程技术网

使用Jquery获取“新数组”JSONP响应中的第一个元素

使用Jquery获取“新数组”JSONP响应中的第一个元素,jquery,arrays,json,jsonp,Jquery,Arrays,Json,Jsonp,我尽量保持简单: 问题:如何使用JQuery从新数组中获取此处的第一个元素权重 当前JQuery: JSONP响应: 该响应不是JSONP,但可能有效。如果您从未尝试过该方法,您的回调应该查找第二个参数,如下所示: callback_function = function(something, suggestions, somethingElse) { return suggestions[0]; } callback_function("w", new Array("weight", "

我尽量保持简单:

问题:如何使用JQuery从新数组中获取此处的第一个元素权重

当前JQuery:

JSONP响应:


该响应不是JSONP,但可能有效。如果您从未尝试过该方法,您的回调应该查找第二个参数,如下所示:

callback_function = function(something, suggestions, somethingElse)
{
  return suggestions[0];
}
callback_function("w", new Array("weight", "weight loss", "wound"), 0);
callback_function = function(something, suggestions, somethingElse)
{
  return suggestions[0];
}