jQuery JSON database variable applied in Javascript -


This can be an easy task, but I'm just learning the relationship between jQuery, JSON, and Javascript. I used jQuery to drag from my database and designated a variable which is res [i] .showlink is a URL which is a part of my code here for call i.

  $ .get ("http: // databasecall = json", {}, function (res) {$ .mobile.hidePageLoadingMsg (); if (res.length) {var s = (Var i = 0; i & lt; res.length; i ++) for ""; {S + = "and lieutenant; Li>  "+ res [i] .showlink +" & lt; / a & gt; & lt; / li & gt; "$} "#solist") .html (); $ ("#solist"). List view ("refresh")}, "jsn");   

The problem is that I would like to resize [i] the .seowink database variable in the JavaScript function (open Google) outside of the above code. When I go to the database variable race [i] .showlink to reuse, my data is no longer included in the database. How can I reuse the variable outside the jQuery / JSON code? I really appreciate any suggestions thank you!

You are storing that value as an anchor tag's content, you can access it from

Google> .apply (this)

and inside Google Open , you $ (this) .text () < / P>

edit
Another option is to pass the value directly as a parameter.

Change

  javascript: open Google ()   

to

  Javascript: open Google ("+ Res [i] .showlink +) Open   

and then

  function Google () {  

Open the

  function from Google (ShowLink) {  

and

  Use value with the alert (sholin) ;    

Comments