Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('#getLocationForm').submit(function(event) {
- event.preventDefault();
- var location = $(this).serialize(); // this refers to submitted form, serizlize well see later in console:
- console.log(location);
- var display = $("#resultscontainer");
- $.ajax({
- type: "GET",
- url: "/~lebreuillyj/project/scripts/location.php?" + location,
- dataType: "json",
- success: function(result)
- {
- var data3 = JSON.stringify(result);
- data3 = $.parseJSON(data3);
- var locationoutput = "";
- locationoutput+= "<ul id='listingitem'>";
- //MAIN ISSUE IN LOOP
- for(var i=0; i < result.length; i++)
- {
- locationoutput+= "<li class='listing' a href='#'>" + data3[i].display_name + " " + data3[i].lat + " " + data3[i].lon +"</a></li>";
- }
- locationoutput+= "</ul>";
- $("#locationresults_container").css("display", "block");
- $("#locationresults").css("display", "inline");
- $("#locationresults").html(locationoutput);
- },
- error: function(xmlHttpRequest, statusMessage, httpCode)
- {
- alert("HTTP code=" + httpCode + " statusMessage=" + statusMessage + " full response text" + xmlHttpRequest.responseText);
- alert("/~lebreuillyj/project/scripts/location.php?" + location);
- $("#locationresults_container").html("<p class='hello'><h2>Please enter a search querie</h2></p>");
- }
- });
- return false;
- });
- <div id="location_container">
- <h3>Current Location: </h3>
- <div id="result">None</div>
- <div id="location_button_container">
- <button id="find_btn">Get Location</button>
- <button id="change_btn">Change Location</button>
- </div>
- $(".listing").click(function(){
- console.log("hello");
- });
Add Comment
Please, Sign In to add comment