I want the user to be able to change part of the URL to his zip code. I have a text box and a button that I hope will pass the URL value.
JQuery
jQuery(document).ready(function($) { $.ajax({ url : "http://SomeAddress.com/" + PostCode + ".json", dataType : "jsonp", success : function(parsed_json) {
HTML:
<input type="text" id="GetPostCode" /> <button id="SetPostCode">Set This Post Code</button>
JQuery
$("#SetPostCode").click(function() { var PostCode = document.getElementById("GetPostCode").value; $("#GetPostCode").val(" "); return false; });
I understand that the line
$.ajax({ url : "http://api.wunderground.com/api/2508132ae0c7601a/geolookup/conditions/q/UK/" + PostCode + ".json",
not working, but I did not know what else to do. Can someone please show me what I need to do to make this work?
source share