locked
data from asp.net to jQuery RRS feed

  • Question

  • Hi,

    I am trying to pass some data from server to a jQuery script with google maps code.

    I tried different ways. In the first case I defined a label (lblData) in aspx and put a string into it from page.Load event in aspx.vb.

    In the script I get the label content with $("#MainContent_lblData").text() and put it in a variable, so that I can use it anywhere in the script. It works, but I don't want the label content to be visible on the page, so I used the label's property "visible" to false. The drawback is that this way I cannot see the label's content in the script either.

    The second way, I defined a public function (getData()) in aspx.vb that returns a string. In the script I defined a variable and assigned it the return value of the function like var info = '<%=getData() %>'. When I use the variable, it's content is a string like '<%=getData() %>' and not the return value of the function. So it is not working.

    I am trying this simple test, but actually I want to pass an array of coordinates, stored in SQL Server, to create markers in a google map.

    Is there a simple way to do it without using web methods, web services, WCF or other complex procedures?

    Thanks

    • Moved by Jason Dot Wang Monday, September 23, 2013 6:42 AM This thread is about ASP.NET
    Sunday, September 22, 2013 2:36 PM

Answers

  • Hi ArchetA,

      Welcome to MSDN Forum Support.

      You are more likely to get more efficient responses to ASP.NET issues at http://forums.asp.net where you can contact ASP.NET experts.

      Sincerely,

      Jason Wang



    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Proposed as answer by Just Karl Monday, September 23, 2013 8:35 PM
    • Marked as answer by Just Karl Tuesday, October 1, 2013 5:14 PM
    Monday, September 23, 2013 6:41 AM