ajax - Why my global variable isnt modified inside a JavaScript callback function -


I want to modify the json object in a function and then the value received on another function I want to use. This is in the form of a glimpse that I have coded:

  $ (document) .ready (function () {var json $ ("# ok"). Click (function () {Function plotReglaFalsa (Respuesta) {json = respuesta} .... .... plot Rigla Fossa (anyJSON) function populateTable () {console.log (json)} populateTable ()})  

Although Jason is not being modified, I have modified JSN to call the necessary function call and console.log statement prints are undefined. I also know That re Spuesta is a valid object.

However, plotReglaFalsa is actually a callback argument in an AJAX request, this is my complete code:

  $ (Document) .ready (function () {var json $. Plot ($ ("# placeholder"), [[]], {yaxis: {show: true, max: 100, min: -100}, exxis: {Show: true, maximum: 100, min: -100}}); $ ("# ok"). Click (function () {var args = {algorithm: 'regla "$" ("#A"). Val () + "" + $ ("# b" parameter: "\" "$$" ("# fx"). Val () + "\ ') .val () +" "+ $ (" # tolerancia "). Val () +" "$ (" # iteraciones maxima "). Val ()} Function plot resuesta {Json = respuesta var for results = [] (var series in respcesta) {If (series! = "X" & Series! = "Y") results in Piash ({Data: [respuesta [series]. A, Respuesta [series]., [Respuesta [series] .b, respuesta [series] .g]]})}} result. "(Label:" fx ", color:" # fb 2365 ", data: _. Zip (respuesta ['x'], respuesta ['y'])} plot = $ .plot ($ ("{interaction: true}, grid: {marks: [xxis: {from: 0.0, to: 0.0} , Color: 'black', linewidth: 1}, {yaxis: {from 0.0, to: 0.0}, color: 'a ("/ Plot", Arg, plot, Regal Falsa) populateTa Adyand ("table id = 'resultados' class). = 'Table Table-boundary' 'gt; & lt; thead & gt; & lt; th & gt; Bill & gt; function populateTable () {console.log (json) $ ("body"). & Lt; / Th >> gt  

and this populates the table function:

  function getSendingJSON (Url, reqObject, callback) {$ .ajax ({type : "To get", data: Rick object, datatype: "jason", url: url, success: (feedback) on the function {callback ());}}}  

To understand that the issue is AJAX standard Is around, what is the easiest way to assign a reply to a variable?


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -