下面代码是我从一网站上载下的,我想问这个json提交到那里?是从那里得到function(data)的值的?
http://www.landscope.com/search/get-map-drag这个地址用处是什么?
望高手帮忙.jQuery.post("http://www.landscope.com/search/get-map-drag", {location: ""+location+"", size_upper: "1000", size_lower: "0", price: "0", bed_upper: "2", bed_lower: "0", fac: "", type: "", other: "", photo: "", buyorrent: "0", pageno: "", perpage: "99999", sort: "", sortPrice: "", quick: "0", x1: ""+x1+"", x2: ""+x2+"", y1: ""+y1+"", y2: ""+y2+"", olType: "Rent", time: "", day: ""},
function(data){
var points = new Array();
var i = 0;
var totalData = data.length;

for (mIndex in data) {
var stockId = data[mIndex].stockId;
var district = data[mIndex].district;
var x = data[mIndex].x;
var y = data[mIndex].y;
var de_id = data[mIndex].de_id;
var district_id = data[mIndex].district_id;
var point = new GLatLng(x,y); 
var olType = data[mIndex].olType; 

var defaultlocation = "'6','7','8'";
var newdefaultloction = defaultlocation.replace(/'/g, "");
var temp1 = new Array();
temp1 = newdefaultloction.split(","); if (Search_Array(temp1, district_id) == true) {
var er = createMarkerMap(point,'http://www.landscope.com/',stockId,customIcons["default"],x,y,'',district,de_id,olType);
} else {
var er = createMarkerMap(point,'http://www.landscope.com/',stockId,customIcons["other"],x,y,'',district,de_id,olType);
}

//if (district_id == "Array") {
// var er = createMarkerMap(point,'http://www.landscope.com/',stockId,customIcons["default"],x,y,'',district,de_id,olType);
//} else {
// var er = createMarkerMap(point,'http://www.landscope.com/',stockId,customIcons["other"],x,y,'',district,de_id,olType);
//}

//var er = createMarkerMap(point,'http://www.landscope.com/',stockId,erOptions,x,y,'',district,de_id,olType);
points[i] = point; i++;
map.addOverlay(er);
}

if (totalData <= 0) {
var noresult = new OverlayMessage(document.getElementById('map'));
var noresultTxt = '<p class="noRstTitle">Your Search returned 0 listing.</p><p class="noRstOtherMsg">If you need further assistance, please contact our <a href="http://www.landscope.com/about-us/people/">KeyPersons</a> or send us an email at <a href="mailto:[email protected]">[email protected]</a>.</p>'; 
noresult.Set('<div class="mapMsg"><div class="loadingImg">'+noresultTxt+'</div>');
var top = ( jQuery('#map').height() - jQuery('.loadingImg').height() ) / 2 - 20;
jQuery('.loadingImg p').css({'padding-bottom':'5px', 'line-height':'140%'});
jQuery('.loadingImg p a').css({'text-decoration':'underline','color':'#FFF'});
jQuery('.loadingImg').css({'padding-top':top, 'width': '500px', 'margin':'0 auto'});
jQuery('.mapMsg').css({'text-decoration':'none'});
jQuery('#msgboxmap').css({'opacity':'0.85'});
}


jQuery('#showTotalCount').text(totalData);

if ( (init == true) || (reset != '') ) {
var bounds = new GLatLngBounds();
for (var i=0; i< points.length; i++) {
bounds.extend(points[i]);


var zoomLevel = map.getBoundsZoomLevel(bounds); 
var centerMap = bounds.getCenter(); 
if (zoomLevel < 4) {
map.setCenter(new GLatLng(22.2614, 114.1716), 13);
} else if (zoomLevel > 20) {
map.setCenter(centerMap, 19);
} else {
map.setCenter(centerMap, zoomLevel);
}
init = false;

/*
GEvent.addListener(map, "zoomend", function(oldLevel,  newLevel) {
   map.clearOverlays();
   refreshMap();
   });
*/
}

om.Clear(); // Clear the loading message

}, "json");

解决方案 »

  1.   

    这个data就是提交到http://www.landscope.com/search/get-map-drag的返回值(是JSON格式的)
      

  2.   

    我能不能模拟得到这个data的内容?
      

  3.   

    http://www.landscope.com/search/get-map-drag
    跨域了吧  。
      

  4.   

    恩,说没有权限. 我能不能提交到一个指定的文件.比如在我目录里建一个文件.1,应该建什么文件,.JS/或是.PHP/.asp?
    2,这个文件应该怎么写var data=[{"",""}]?
    3,能不能得到提交过的这个文件的ID?我要模这个地图.哎,望高手帮我.
      

  5.   

    这是jQuery的post接口,官方文档介绍为:jQuery.post( url, [data], [callback], [type] );这个函数是用于发出Ajax请求的,url是在服务器端用来接收参数的,它可以对提交的参数进行处理,并返回一定格式的数据,必须xml、json格式等。这个函数的请求结果有多种状态,比如success、failure等,当请求状态为success的时候,回调function(data) {}这个函数,在这个函数里面操作html文档。可以看到它有四个参数,
    url是指:将[data]参数提交到url所指定的页面进行处理;
    [data]:要提交的数据;
    callback:请求成功时的回调函数;
    type:返回给回调函数的data参数的数据类型;(比如$.postJSON,这个就会调用$.post(url, data, function(data) {}, 'json));这个jQuery.post并不处理跨域问题!
      

  6.   

    var data=[{stockId:"11",district:"abc",....},{stockId:"12",district:"abc22",....},...]
      

  7.   

    要使用jQuery来进行跨域请求,可以参考:
    https://github.com/jamespadolsey/jQuery-Plugins/tree/master/cross-domain-ajax/
      

  8.   

    谢谢,我看看下.如果在我的目录里建一个json文件.这个json为什么扩展名?jQuery.post("127.0.0.1", {location: ""+location+"", size_upper: "1000", size_lower: "0", price: "0", bed_upper: "2", bed_lower: "0", fac: "", type: "", other: "", photo: "", buyorrent: "0", pageno: "", perpage: "99999", sort: "", sortPrice: "", quick: "0", x1: ""+x1+"", x2: ""+x2+"", y1: ""+y1+"", y2: ""+y2+"", olType: "Rent", time: "", day: ""},json.?var data[{"stockId","1"....}]
      

  9.   

    可以这样写吗?
    jQuery.post( "test.php", {id:"10"}, [callback], [json] )?{location: ""+location+"", size_upper: "1000", size_lower: "0", price: "0", bed_upper: "2", bed_lower: "0", fac: "", type: "", other: "", photo: "", buyorrent: "0", pageno: "", perpage: "99999", sort: "", sortPrice: "", quick: "0", x1: ""+x1+"", x2: ""+x2+"", y1: ""+y1+"", y2: ""+y2+"", olType: "Rent", time: "", day: ""} 
    这一段是提交到"test.php"参数.
      

  10.   

    test.php 我是这样写的.有什么问题吗?<? if($_REQUEST["id"]==1){?>
    <script>
    var data=[{"stockId":"1","x":"22.2158","y":"114.2049","district":"123","de_id":"1","olType":"1"}];
    </script>
    <?}?>
      

  11.   

    你在test.php输出你想要的东西 ,
    看看post()函数能否接收到 。
      

  12.   

    怎么测试能看到post()能否收到?能写个代码给我看看吗?
      

  13.   

    如果jQuery.post( "test.php", {id:"10"}, [callback], json ),我是不是还要引入一个json包才行?
      

  14.   

    jQuery.post( "test.php", {id:"10"}, [callback], json )为什么数据格式用json就不能返回值?
      

  15.   

    你的php文件写错了!
    测试下面的代码:
    js:jQuery.post( "test.php", {id:"10"}, function(data){alert(data.result);}, json );php文件:<?php
    echo '{"result":true,"errno":0,"msg":"success","timestamp":1283238659,"data":null}';php很简单的,想返回数据只要echo就可以了。还是那句话,楼主用firebug(或者httpwatch)看请求吧,一目了然,不用这么费劲想!!
      

  16.   

    谢谢chen_wen_xiu,可以取到值了.原来前面的data=不要就可以了.
      

  17.   

    顺便再问一句:asp如何获取jQuery.post传给asp的值用request.form()吗?
      

  18.   

    知道了,用request()可以取得.再问一下,asp如可算得google的地图范围?
      

  19.   

    你如果要得到的话,你要能request.responseText来得到的