Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
HTML Pages with CSS and JavaScript
undefined value
jen lemque
Greenhorn
Posts: 28
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Undefined Value in my callback code exist...
var so; var imgid_callback1; const DIV_ID = 'locationsample'; function setup(){ try { so = device.getServiceObject("Service.Location", "ILocation"); } catch (e) { alert('<setup> ' +e); } } function getLocation(imgId) { var updateoptions = new Object(); // Setting PartialUpdates to 'FALSE' ensures that user get atleast // BasicLocationInformation (Longitude, Lattitude, and Altitude.) updateoptions.PartialUpdates = false; var criteria = new Object(); criteria.LocationInformationClass = "BasicLocationInformation"; criteria.Updateoptions = updateoptions; try { var result = so.ILocation.GetLocation(criteria); if(!checkError("ILocation::getLocation",result,DIV_ID,imgId)) { document.getElementById(DIV_ID).innerHTML = showObject(result.ReturnValue); } } catch (e) { alert ("getLocation: " + e); } } function getLocationAsync(imgId) { var updateoptions = new Object(); updateoptions.PartialUpdates = false; var criteria = new Object(); criteria.LocationInformationClass = "BasicLocationInformation"; criteria.Updateoptions = updateoptions; imgid_callback1 = imgId; try { var result = so.ILocation.GetLocation(criteria, callback1); if(!checkError("ILocation::getLocationAsync",result,DIV_ID,imgId)) { showIMG(imgId,""); } } catch (e) { alert ("getLocationAsync: " + e); } } function callback1(transId, eventCode, result){ var latitude = result.ReturnValue.Latitude;<----------------------------[b]Line Error:undefined value[/b] var longitude = result.ReturnValue.Longitude; var req = null; try { req = new XMLHttpRequest(); if (typeof req.overrideMimeType != "undefined") { req.overrideMimeType("text/xml"); } req.onreadystatechange = function() { if (req.readyState == 4) { if (req.status == 200) { } } else { alert("Error"); } } req.open("POST","http://localhost:8080/getGPS/location",true); req.setRequestHeader("longitude",+longitude); req.setRequestHeader("latitude",+latitude); req.send(); } catch (ex) { alert(ex); } }
why is that that value found undefined...
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Please take the time to choose the correct forum for your posts. This forum is for questions on
Servlets
. For more information, please
read this
.
This post has been moved to a more appropriate forum.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You are going to need to provide more detail. You posted a lot of code without any indication of where the error occurs.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Problems sending and receiving with XMLHttpRequest
I am getting unspecified error
xmlhttprequest is not sending any request to the servlet
IE 6 problem with Dates?
Servlet can't get the xmlhttp post request
More...