$.ajax({ type: "POST",url: "includes/PHPscripts?action=manage",data: {location: loc,lat: latitude,lon: longitude,heading: head,filename: file},success: function(){ $("#panoInfo").html("<div id='message'></div>"); $("#message").html("Valid Submission"); } });
我指定了POST方法,因为我不希望通过URL看到变量.但是,他们是.
我发布之前的测试网址是
http://localhost/JMCTour/buildtour.PHP
然后
http://localhost/JMCTour/buildtour.PHP?filename=1-prefix_blended_fused.jpg&location=Start+of+Tour&lat=43.682211&long=-70.450705&heading=100&submit=Save
为什么?
解决方法
data
Data to be sent to the server. It is converted to a query string,if not already a string. It’s appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array,jQuery serializes multiple values with same key based on the value of the traditional setting (described below).
因此:
processDataBoolean
Default: true
By default,data passed in to the data option as an object (technically,anything other than a string) will be processed and transformed into a query string,fitting to the default content-type “application/x-www-form-urlencoded”. If you want to send a DOMDocument,or other non-processed data,set this option to false.