Is there anyway to update an exising array defined inside HTML?How do I format a Microsoft JSON date?JavaScript/jQuery to download file via POST with JSON dataHow do I use arrays in C++?Retrieving a json array from a cakePHP controllerHow to get distinct values from an array of objects in JavaScript?How to pass parameters in GET requests with jQueryjQuery AJAX .done not firing for JSON dataUnderstanding unique keys for array children in React.jsjson_encode variable inside arrayHow To Loop and Load Section of JSON to New Array

Are there any individual aliens that have gained superpowers in the Marvel universe?

In windows systems, is renaming files functionally similar to deleting them?

How to ask if I can mow my neighbor's lawn

Can you create a noise using Minor Illusion/Thaumaturgy on an area you cannot see?

Is it possible to use just one shared folder for log shipping?

What kind of chart is this?

How do credit card companies know what type of business I'm paying for?

How much steel armor can you wear and still be able to swim?

What is the context for Napoleon's quote "[the Austrians] did not know the value of five minutes"?

Got a new frameset, don't know why I need this split ring collar?

Why was New Asgard established at this place?

How can caller ID be faked?

Do Battery Electrons Only Move If There is a Positive Terminal at the End of the Wire?

Using roof rails to set up hammock

Is this broken pipe the reason my freezer is not working? Can it be fixed?

Bash function: Execute $@ command with each argument in sequence executed separately

Explicit song lyrics checker

Who was the youngest Executive Producer?

...and then she held the gun

Harmonic Series Phase Difference?

A medieval book with a redhead girl as a main character who allies with vampires and werewolves against scientific opposition

How can I ping multiple IP addresses at the same time?

How could I create a situation in which a PC has to make a saving throw or be forced to pet a dog?

Build a scale without computer



Is there anyway to update an exising array defined inside HTML?


How do I format a Microsoft JSON date?JavaScript/jQuery to download file via POST with JSON dataHow do I use arrays in C++?Retrieving a json array from a cakePHP controllerHow to get distinct values from an array of objects in JavaScript?How to pass parameters in GET requests with jQueryjQuery AJAX .done not firing for JSON dataUnderstanding unique keys for array children in React.jsjson_encode variable inside arrayHow To Loop and Load Section of JSON to New Array






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















There is a static array which should be dynamically updated based upon click event.



I am able to get the dynamic value in an array format using Ajax but finding difficulties in setting it to the existing variable.



Ajax returns the below array



echo json_encode($arry);
// ["2","1","1","0","1","0"]


$.post( "ajaxcall.php", ids: id )
.done(function( returnedArray)
//returnedArray looks like ["2","1","1","0","1","0"]
datasets: [
//data: [10,12,33,50,12,34]
data: returnedArray
]
,


But after the click event, returnedArray does not get interpreted to place the value.



Bacialy the result should look like below:



data: ["2","1","1","0","1","0"]









share|improve this question




























    0















    There is a static array which should be dynamically updated based upon click event.



    I am able to get the dynamic value in an array format using Ajax but finding difficulties in setting it to the existing variable.



    Ajax returns the below array



    echo json_encode($arry);
    // ["2","1","1","0","1","0"]


    $.post( "ajaxcall.php", ids: id )
    .done(function( returnedArray)
    //returnedArray looks like ["2","1","1","0","1","0"]
    datasets: [
    //data: [10,12,33,50,12,34]
    data: returnedArray
    ]
    ,


    But after the click event, returnedArray does not get interpreted to place the value.



    Bacialy the result should look like below:



    data: ["2","1","1","0","1","0"]









    share|improve this question
























      0












      0








      0








      There is a static array which should be dynamically updated based upon click event.



      I am able to get the dynamic value in an array format using Ajax but finding difficulties in setting it to the existing variable.



      Ajax returns the below array



      echo json_encode($arry);
      // ["2","1","1","0","1","0"]


      $.post( "ajaxcall.php", ids: id )
      .done(function( returnedArray)
      //returnedArray looks like ["2","1","1","0","1","0"]
      datasets: [
      //data: [10,12,33,50,12,34]
      data: returnedArray
      ]
      ,


      But after the click event, returnedArray does not get interpreted to place the value.



      Bacialy the result should look like below:



      data: ["2","1","1","0","1","0"]









      share|improve this question














      There is a static array which should be dynamically updated based upon click event.



      I am able to get the dynamic value in an array format using Ajax but finding difficulties in setting it to the existing variable.



      Ajax returns the below array



      echo json_encode($arry);
      // ["2","1","1","0","1","0"]


      $.post( "ajaxcall.php", ids: id )
      .done(function( returnedArray)
      //returnedArray looks like ["2","1","1","0","1","0"]
      datasets: [
      //data: [10,12,33,50,12,34]
      data: returnedArray
      ]
      ,


      But after the click event, returnedArray does not get interpreted to place the value.



      Bacialy the result should look like below:



      data: ["2","1","1","0","1","0"]






      javascript jquery html arrays ajax






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 5:01









      Shashi RoyShashi Roy

      62




      62






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Use the assignment operator instead of :



          datasets = [
          //data: [10,12,33,50,12,34]
          data: returnedArray
          ]





          share|improve this answer























          • Actually I have put the trimmed code in my query. There are other variables and value under datasets which are comma separated. When I use = to assign the value then it throws an error and says that : is missing.

            – Shashi Roy
            Mar 25 at 5:13











          • For an example the in actual code looks like below: ``` datasets = [ //data: [10,12,33,50,12,34] responsive: true, maintainAspectRatio: false, data: returnedArray ] ```

            – Shashi Roy
            Mar 25 at 5:13












          • @Shashi Roy Can't say anything with seeing the all code. But datasets: [ //data: [10,12,33,50,12,34] data: returnedArray ] } inside a function will never change the value of datasets

            – Maheer Ali
            Mar 25 at 5:36











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55331495%2fis-there-anyway-to-update-an-exising-array-defined-inside-html%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Use the assignment operator instead of :



          datasets = [
          //data: [10,12,33,50,12,34]
          data: returnedArray
          ]





          share|improve this answer























          • Actually I have put the trimmed code in my query. There are other variables and value under datasets which are comma separated. When I use = to assign the value then it throws an error and says that : is missing.

            – Shashi Roy
            Mar 25 at 5:13











          • For an example the in actual code looks like below: ``` datasets = [ //data: [10,12,33,50,12,34] responsive: true, maintainAspectRatio: false, data: returnedArray ] ```

            – Shashi Roy
            Mar 25 at 5:13












          • @Shashi Roy Can't say anything with seeing the all code. But datasets: [ //data: [10,12,33,50,12,34] data: returnedArray ] } inside a function will never change the value of datasets

            – Maheer Ali
            Mar 25 at 5:36















          1














          Use the assignment operator instead of :



          datasets = [
          //data: [10,12,33,50,12,34]
          data: returnedArray
          ]





          share|improve this answer























          • Actually I have put the trimmed code in my query. There are other variables and value under datasets which are comma separated. When I use = to assign the value then it throws an error and says that : is missing.

            – Shashi Roy
            Mar 25 at 5:13











          • For an example the in actual code looks like below: ``` datasets = [ //data: [10,12,33,50,12,34] responsive: true, maintainAspectRatio: false, data: returnedArray ] ```

            – Shashi Roy
            Mar 25 at 5:13












          • @Shashi Roy Can't say anything with seeing the all code. But datasets: [ //data: [10,12,33,50,12,34] data: returnedArray ] } inside a function will never change the value of datasets

            – Maheer Ali
            Mar 25 at 5:36













          1












          1








          1







          Use the assignment operator instead of :



          datasets = [
          //data: [10,12,33,50,12,34]
          data: returnedArray
          ]





          share|improve this answer













          Use the assignment operator instead of :



          datasets = [
          //data: [10,12,33,50,12,34]
          data: returnedArray
          ]






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 25 at 5:04









          Maheer AliMaheer Ali

          21.6k41937




          21.6k41937












          • Actually I have put the trimmed code in my query. There are other variables and value under datasets which are comma separated. When I use = to assign the value then it throws an error and says that : is missing.

            – Shashi Roy
            Mar 25 at 5:13











          • For an example the in actual code looks like below: ``` datasets = [ //data: [10,12,33,50,12,34] responsive: true, maintainAspectRatio: false, data: returnedArray ] ```

            – Shashi Roy
            Mar 25 at 5:13












          • @Shashi Roy Can't say anything with seeing the all code. But datasets: [ //data: [10,12,33,50,12,34] data: returnedArray ] } inside a function will never change the value of datasets

            – Maheer Ali
            Mar 25 at 5:36

















          • Actually I have put the trimmed code in my query. There are other variables and value under datasets which are comma separated. When I use = to assign the value then it throws an error and says that : is missing.

            – Shashi Roy
            Mar 25 at 5:13











          • For an example the in actual code looks like below: ``` datasets = [ //data: [10,12,33,50,12,34] responsive: true, maintainAspectRatio: false, data: returnedArray ] ```

            – Shashi Roy
            Mar 25 at 5:13












          • @Shashi Roy Can't say anything with seeing the all code. But datasets: [ //data: [10,12,33,50,12,34] data: returnedArray ] } inside a function will never change the value of datasets

            – Maheer Ali
            Mar 25 at 5:36
















          Actually I have put the trimmed code in my query. There are other variables and value under datasets which are comma separated. When I use = to assign the value then it throws an error and says that : is missing.

          – Shashi Roy
          Mar 25 at 5:13





          Actually I have put the trimmed code in my query. There are other variables and value under datasets which are comma separated. When I use = to assign the value then it throws an error and says that : is missing.

          – Shashi Roy
          Mar 25 at 5:13













          For an example the in actual code looks like below: ``` datasets = [ //data: [10,12,33,50,12,34] responsive: true, maintainAspectRatio: false, data: returnedArray ] ```

          – Shashi Roy
          Mar 25 at 5:13






          For an example the in actual code looks like below: ``` datasets = [ //data: [10,12,33,50,12,34] responsive: true, maintainAspectRatio: false, data: returnedArray ] ```

          – Shashi Roy
          Mar 25 at 5:13














          @Shashi Roy Can't say anything with seeing the all code. But datasets: [ //data: [10,12,33,50,12,34] data: returnedArray ] } inside a function will never change the value of datasets

          – Maheer Ali
          Mar 25 at 5:36





          @Shashi Roy Can't say anything with seeing the all code. But datasets: [ //data: [10,12,33,50,12,34] data: returnedArray ] } inside a function will never change the value of datasets

          – Maheer Ali
          Mar 25 at 5:36

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55331495%2fis-there-anyway-to-update-an-exising-array-defined-inside-html%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript