如何在javascript中获取URL响应并解析JSON响应?

时间:2015-08-10 11:38:09

标签: javascript json parsing

我有这样的功能。我如何得到响应并解析即将到来的json响应?

function load_login() {
    document.getElementById("content1").style.visibility = "hidden";
    document.getElementById("content1").innerHTML='<object type="text/html" data="http://<?php echo $proip; ?>/cgi-bin/dologin?login&username=admin&password=admin"></object>';
}

2 个答案:

答案 0 :(得分:0)

SELECT
 t.order_id as "Order ID", t.BY1 as "By", t.O_DATE as "Order Date",
 tr.short_name as "Customer short name", tr.www as "Customer website", 
 tr.owner as "Customer owner", tr.postcode as "Customer postcode"
FROM customer_special t
JOIN customer_nuk
INNER JOIN customer_data AS tr 
ON t.customer = tr.id
LIMIT 50 

服务器响应错误代码     }

To get a response, you need to hit the server with AJAX call.Most simply in jquery ,like below:

$.ajax({
 url:"",//pass the api `enter code here`
 data:{},// your url endpoints you want to send to server
 success:function(data)
{ 
//if server responded with status code 200,then you will get server response in the data object
 },
error:function()
{

一旦能够获得响应,就可以使用JSON.parse()方法进行数组转换。

答案 1 :(得分:0)

<json:json-to-object-transformer returnClass="java.util.HashMap" doc:name="JSON to Object" />
<logger message="#[message.payload.result.p_ProviderID]" level="INFO" doc:name="Logger"/>