我想將Postcode Anywhere實現到我的站點中。因此,如果他們在事件郵政編碼字段中輸入郵編,系統將顯示與該郵編代碼和用戶相關的地址將選擇相關的地址,地址細節將隨後填充事件地址field.I的其餘部分正在使用我的網頁下面的代碼:我試圖將Postcode Anywhere實現到我的站點
function CapturePlus_Interactive_Find_v2_10Begin(Key, SearchTerm, LastId, SearchFor, Country, LanguagePreference, MaxSuggestions, MaxResults) {
var script = document.createElement("script"),
head = document.getElementsByTagName("head")[0],
url = "http://services.postcodeanywhere.co.uk/CapturePlus/Interactive/Find/v2.10/json3.ws?";
// Build the query string
url += "&Key=" + encodeURIComponent(Key);
url += "&SearchTerm=" + encodeURIComponent(SearchTerm);
url += "&LastId=" + encodeURIComponent(LastId);
url += "&SearchFor=" + encodeURIComponent(SearchFor);
url += "&Country=" + encodeURIComponent(Country);
url += "&LanguagePreference=" + encodeURIComponent(LanguagePreference);
url += "&MaxSuggestions=" + encodeURIComponent(MaxSuggestions);
url += "&MaxResults=" + encodeURIComponent(MaxResults);
url += "&callback=CapturePlus_Interactive_Find_v2_10End";
script.src = url;
// Make the request
script.onload = script.onreadystatechange = function() {
if (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") {
script.onload = script.onreadystatechange = null;
if (head && script.parentNode)
head.removeChild(script);
}
}
head.insertBefore(script, head.firstChild);
}
function CapturePlus_Interactive_Find_v2_10End(response) {
// Test for an error
if (response.Items.length == 1 && typeof(response.Items[0].Error) != "undefined") {
// Show the error message
alert(response.Items[0].Description);
}
else {
// Check if there were any items found
if (response.Items.length == 0)
alert("Sorry, there were no results");
else {
// PUT YOUR CODE HERE
//FYI: The output is an array of key value pairs (e.g. response.Items[0].Id), the keys being:
//Id
//Text
//Highlight
//Cursor
//Description
//Next
}
}
}
我不知道什麼是在其他部分被寫入的代碼(我需要把實際的代碼映射到值)。任何人都可以幫我解決這個問題嗎?
所以你複製從http://services.postcodeanywhere.co.uk/的代碼,在這裏需要一些幫助..顯示什麼你完成了。 – lordkain