以下是我已经使用的脚本,它只是将内容放在uint8_t globalColorTableFlag = 1;
uint8_t colorResolution = 001;
uint8_t sortFlag = 0;
uint8_t sizeOfGlobalColorTable = 001;
uint32_t packed = ((globalColorTableFlag << 24) | (colorResolution << 16) | (sortFlag << 8) | (sizeOfGlobalColorTable << 0));
NSLog(@"%d",packed); // Logs 16842753, should be: 10010001
NSLog(@"0x%02X",packed); // Logs 0x1010001, should be: 0x91
的index.php
response.php
response.php
<input type="button" id="fire" value="Show Items">
<script src="http://code.jquery.com/jquery-1.7.2.js"></script>
<script type="text/javascript">
$("#fire").click(function(){
$.ajax({
type: "POST",
url : "response.php",
data: {
'test': 'test',
},
success : function(data)
{
$("#result").html(data);
}
},"json");
});
</script>
<div id="result"></div>
我尝试通过此代码制作google autosuggest
<?php
echo '
<input type="text" id="startingloc">
<input type="text" id="endingloc">';
?>
我正在
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script>
<script type="text/javascript">
$("#startingloc").on("input",function() {
//alert("Change detected!");
console.log("Changed");
});
google.maps.event.addDomListener(window, "load", function () {
var places = new google.maps.places.Autocomplete(document.getElementById("startingloc"));
var places = new google.maps.places.Autocomplete(document.getElementById("endingloc"));
google.maps.event.addListener(places, "place_changed", function () {
var place = places.getPlace();
var address = place.formatted_address;
var latitude = place.geometry.location.k;
var longitude = place.geometry.location.D;
var mesg = "Address: " + address;
mesg += "\nLatitude: " + latitude;
mesg += "\nLongitude: " + longitude;
});
});
</script>
<input type="text" id="startingloc">
<input type="text" id="endingloc">
当我尝试在主页中添加javascript时,我没有在那里获得自动提示。
我该如何解决这个问题?
以下是我的最新代码
的index.php
Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
response.php
<input type="button" id="fire" value="Show Items">
<script src="http://code.jquery.com/jquery-1.7.2.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script>
<script type="text/javascript">
$("#fire").click(function(){
$.ajax({
type: "POST",
url : "response.php",
data: {
'test': 'test',
},
success : function(data)
{
$("#result").html(data);
}
},"json");
});
</script>
<div id="result"></div>
答案 0 :(得分:0)
只需删除
即可 google.maps.event.addDomListener(window, "load", function () {
[并且结束});
]
在response.php
并且不要尝试从您的ajax页面加载.js
并始终从父页面加载它。
所以你的代码将是
response.php
<?php
echo '
<script type="text/javascript">
var places = new google.maps.places.Autocomplete(document.getElementById("startingloc"));
var places = new google.maps.places.Autocomplete(document.getElementById("endingloc"));
google.maps.event.addListener(places, "place_changed", function () {
var place = places.getPlace();
var address = place.formatted_address;
var latitude = place.geometry.location.k;
var longitude = place.geometry.location.D;
var mesg = "Address: " + address;
mesg += "\nLatitude: " + latitude;
mesg += "\nLongitude: " + longitude;
});
</script>
<input type="text" id="startingloc">
<input type="text" id="endingloc">';
?>
您的index.php
将保持不变