Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<script type="text/javascript">
C#
function saveData() {

           document.getElementById('div_panel').style.visibility = 'visible';

           var latlat = marker.getPosition().lat();
           var latlng = marker.getPosition().lng();
           alert(marker.getPosition().lat());
           Session["latitute"] = marker.getPosition().lat();
           Session["longitute"] = marker.getPosition().lng();




       }

</script>

when i print alert(marker.getPosition().lat()); then it will display 20.550508894195637 and when i store in session["latitute"]=marker.getPosition().lat(); than it will create session in string

how can i store latitude value in session in java script ??
Posted

 
Share this answer
 
Comments
Bama Boy 22-Aug-13 8:26am    
its not working its also display same string '+marker.getPosition
thatraja 22-Aug-13 8:38am    
Show me the updated script
Bama Boy 22-Aug-13 8:43am    
function saveData() {

document.getElementById('div_panel').style.visibility = 'visible';

var latlat = marker.getPosition().lat();
var latlng = marker.getPosition().lng();

'<% Session["latitute"] ="'+ latlat+'";%>'
'<% Session["longitute"] ="'+ latlng+'";%>'




}

when i store than print this '+ latlat+'
There is nothing as such as "Session" in Javascript. But there are many alternative methods to store some values to use across pages in Javascript like Cookies, and there are some Javascript libraries allow you to store values across pages.
http://www.thomasfrank.se/sessionvars.html[^]
http://pablotron.org/?cid=1557[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900