Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New Page - Parameters/Update DB

Status
Not open for further replies.

jiggyg

Programmer
Oct 1, 2007
61
US
Hello List!

I have a question on how to handle something...

I have one page that gets data from google maps & I want to get these values and then go to another page (updateAddress.asp) where I will do the update.

I'm getting the data correctly, but having issues with getting it to go to the update page; not sure if my syntax is correct for that or not?!??

Here's my page so far:

Code:
<html>
<head>
<title>GIS gPoint Grabber</title>

<script type="text/javascript" Language="JavaScript">
function ajax_getValue(aid,Pg){ 
  var xhr;
  try {xhr = new XMLHttpRequest()}                 
    catch(e) {xhr = new ActiveXObject(Microsoft.XMLHTTP)} 

  xhr.onreadystatechange = function(){ 
    if(xhr.readyState == 4){
	if(xhr.status == 200){
	  if(aid != null){
	    var retVal = xhr.responseText.split(",");
	    var frm = document.forms[0];
	    updatePage = "updateAddress.asp?aid=" + aid + "&acc=" + retVal[1] + "&lat=" + retVal[2] + "&lng=" + retVal[3];
	    ajax_getValue(null,updatePage);
	  }
	}
      }
    }
    xhr.open("GET", Pg, true); 
    xhr.send(null);
}

function getAddresses(){
  var url = "http%3A%2F%2Fmaps%2Egoogle%2Ecom%2Fmaps%2Fgeo%3Fkey%3DABQIAAAAPUNuytFVXrrfYEJt8knUDRTsC5VVVLeRkWyzZ2yPrwis7aeZehTdy1yIPN%5FKooi0q3MxTRebOB4Cab%26output%3Dcsv%26q%3D%2C+Atlanta%2C+GA%2C";
  ajax_getValue(1, "proxy.asp?url=" + url + "&mimeType=text");
}

</script>
</head>

<body onLoad="getAddresses()">

<form>
<input type="text" name="aid"><br>
<input type="text" name="retCode"><br>
<input type="text" name="accuracy"><br>
<input type="text" name="latitude"><br>
<input type="text" name="longitude"><br>
</form>

</body>
</html>

I need to go to the updatePage and do the update in the 'ajax_getValue(aid,Pg)' function....

I know the data is being returned correctly, because if i put in an alert box:

Code:
  updatePage = "updateAddress.asp?aid=" + aid + "&acc=" + retVal[1] + "&lat=" + retVal[2] + "&lng=" + retVal[3];
  alert (updatePage);

an alert box w/ the correct aid, accuracy, latitude, and longitude is popping up; just not going to updateAddress page and updating db.

Thanks much!
-jiggyg
 
After working on this some more, I think my issue is getting it to go to the update page and passing parameters to that page (but, don't have a submit button on the first page or anything)...

Here's my updateAddress.asp page:
Code:
<%

conn = application("DataConn")
set cn = server.CreateObject("ADODB.Connection")
cn.Open conn
set rs = server.CreateObject("ADODB.Recordset")

response.write "aid: "& request("aid")

if request("aid") <> "" then
  addID = aid
  if request("acc") <> "" then
    addPrecision = request("acc")		
  else
    addPrecision = NULL
  end if
  if request("lat") <> "" then
    addLat = request("lat")		
  else
    addLat = NULL
  end if
  if request("lng") <> "" then
    addLong = request("lng")		
  else
    addLong = NULL
  end if

  'parameters: addID, addLat, addLong, addPrecision
  sql = "[GISmaps].[dbo].updateAddressInfo " & addID & "," & addLat & "," & addLong & "," & addPrecision
  cn.Execute sql
	
end if
%>

I put the response.write (response.write "aid: "& request("aid")) in there to see if anything is getting to this page, and it isn't...

Thanks in advance for your time and expertise!
-jiggyg
 
Jiggy, can I refer you to the ajax forum forum1600, you may have more luck getting a response there.

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top