how to post associative array in ionic 3How is OAuth 2 different from OAuth 1?google oauth2 grant_type=authorization_code returns Error processing OAuth 2 requestOAuth access token and refresh token creationPHP Console Application with OAuth 2.0 Refresh Tokens, how to store?Ember oauth2 Authentication issuesIonic/Laravel App Client Side Auth Managementregister new user from api route using laravel passportHow to use Laravel Passport with Password Grant Tokens?Angular 6 http post request with x-www-form-urlencoded dataAuthenticate in Microsoft Graph server side application

What does オト mean here?

Why is this int array not passed as an object vararg array?

How to minimise the cost of guessing a number in a high/low guess game?

Exception propagation: When should I catch exceptions?

The CompuTaria Quest - A young Wizard's journey

How did Thanos not realise this had happened at the end of Endgame?

Why was Thor doubtful about his worthiness to Mjolnir?

Run script for 10 times until meets the condition, but break the loop if it meets the condition during iteration

What does i386 mean on macOS Mojave?

Does kinetic energy warp spacetime?

Repair a file using Audacity?

What is the best way for a skeleton to impersonate human without using magic?

use the oversamplling followed by '' decimation method ''to increasee the ADC resolution and not normal averaging

Can I make ravioli dough with only all-purpose flour or do I NEED semolina flour?

Why does the Earth follow an elliptical trajectory rather than a parabolic one?

Do atomic orbitals "pulse" in time?

What are the components of a legend (in the sense of a tale, not a figure legend)?

Create a list of all possible Boolean configurations of three constraints

"Right on the tip of my tongue" meaning?

Why do Thanos's punches not kill Captain America or at least cause some mortal injuries?

What stroke width Instagram is using for its icons and how to get same results?

What's special about a Bunsen burner?

How to slow yourself down (for playing nice with others)

Renting a house to a graduate student in my department



how to post associative array in ionic 3


How is OAuth 2 different from OAuth 1?google oauth2 grant_type=authorization_code returns Error processing OAuth 2 requestOAuth access token and refresh token creationPHP Console Application with OAuth 2.0 Refresh Tokens, how to store?Ember oauth2 Authentication issuesIonic/Laravel App Client Side Auth Managementregister new user from api route using laravel passportHow to use Laravel Passport with Password Grant Tokens?Angular 6 http post request with x-www-form-urlencoded dataAuthenticate in Microsoft Graph server side application






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








0















When i try to post a data in associative array to rest api using ionic.
Only empty data receive in server side.
Is this method is correct or suggest any other method



 public login(credentials) 

let apiUrl = this.urlService.apiUrl + 'oauth/access_token';
let headers = new Headers('Content-Type' : 'application/x-www-form-urlencoded');
let options = new RequestOptions(
headers: headers);

var postcredn=new Array();

postcredn['username'] = "karthik@abcde.in";
postcredn['password'] = "05550";
postcredn['grant_type'] = "password";
postcredn['client_id'] = "Outfit1548669";
postcredn['client_secret'] = "a10620c85033abd17716cda245";


console.log('iii'+postcredn['username'] );

return new Promise((resolve, reject) =>
this.http.post(apiUrl, postcredn, options)

.subscribe(res =>
resolve(JSON.parse(JSON.stringify(res)));
console.log('json'+ JSON.stringify(postcredn));

, (err) =>
reject(err);
console.log(apiUrl);
);
);


} console.log(apiUrl);
});
});
}

}


Thanks in advance










share|improve this question






























    0















    When i try to post a data in associative array to rest api using ionic.
    Only empty data receive in server side.
    Is this method is correct or suggest any other method



     public login(credentials) 

    let apiUrl = this.urlService.apiUrl + 'oauth/access_token';
    let headers = new Headers('Content-Type' : 'application/x-www-form-urlencoded');
    let options = new RequestOptions(
    headers: headers);

    var postcredn=new Array();

    postcredn['username'] = "karthik@abcde.in";
    postcredn['password'] = "05550";
    postcredn['grant_type'] = "password";
    postcredn['client_id'] = "Outfit1548669";
    postcredn['client_secret'] = "a10620c85033abd17716cda245";


    console.log('iii'+postcredn['username'] );

    return new Promise((resolve, reject) =>
    this.http.post(apiUrl, postcredn, options)

    .subscribe(res =>
    resolve(JSON.parse(JSON.stringify(res)));
    console.log('json'+ JSON.stringify(postcredn));

    , (err) =>
    reject(err);
    console.log(apiUrl);
    );
    );


    } console.log(apiUrl);
    });
    });
    }

    }


    Thanks in advance










    share|improve this question


























      0












      0








      0








      When i try to post a data in associative array to rest api using ionic.
      Only empty data receive in server side.
      Is this method is correct or suggest any other method



       public login(credentials) 

      let apiUrl = this.urlService.apiUrl + 'oauth/access_token';
      let headers = new Headers('Content-Type' : 'application/x-www-form-urlencoded');
      let options = new RequestOptions(
      headers: headers);

      var postcredn=new Array();

      postcredn['username'] = "karthik@abcde.in";
      postcredn['password'] = "05550";
      postcredn['grant_type'] = "password";
      postcredn['client_id'] = "Outfit1548669";
      postcredn['client_secret'] = "a10620c85033abd17716cda245";


      console.log('iii'+postcredn['username'] );

      return new Promise((resolve, reject) =>
      this.http.post(apiUrl, postcredn, options)

      .subscribe(res =>
      resolve(JSON.parse(JSON.stringify(res)));
      console.log('json'+ JSON.stringify(postcredn));

      , (err) =>
      reject(err);
      console.log(apiUrl);
      );
      );


      } console.log(apiUrl);
      });
      });
      }

      }


      Thanks in advance










      share|improve this question
















      When i try to post a data in associative array to rest api using ionic.
      Only empty data receive in server side.
      Is this method is correct or suggest any other method



       public login(credentials) 

      let apiUrl = this.urlService.apiUrl + 'oauth/access_token';
      let headers = new Headers('Content-Type' : 'application/x-www-form-urlencoded');
      let options = new RequestOptions(
      headers: headers);

      var postcredn=new Array();

      postcredn['username'] = "karthik@abcde.in";
      postcredn['password'] = "05550";
      postcredn['grant_type'] = "password";
      postcredn['client_id'] = "Outfit1548669";
      postcredn['client_secret'] = "a10620c85033abd17716cda245";


      console.log('iii'+postcredn['username'] );

      return new Promise((resolve, reject) =>
      this.http.post(apiUrl, postcredn, options)

      .subscribe(res =>
      resolve(JSON.parse(JSON.stringify(res)));
      console.log('json'+ JSON.stringify(postcredn));

      , (err) =>
      reject(err);
      console.log(apiUrl);
      );
      );


      } console.log(apiUrl);
      });
      });
      }

      }


      Thanks in advance







      laravel authentication ionic-framework oauth ionic3






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 23 at 11:40







      Karthik

















      asked Mar 23 at 11:00









      KarthikKarthik

      1,44041941




      1,44041941






















          2 Answers
          2






          active

          oldest

          votes


















          1














          Please rewrite following code:



          First you need to create interface like:



          export interface Postdata
          username: String;
          password:String;
          grant_type:String;
          client_id: String;
          client_secret: String;



          Then import it and set its value:



          var postcredn:Postdata;
          postcredn=
          username:'karthik@abcde.in',
          password:'05550',
          grant_type:'password',
          client_id:'Outfit1548669',
          client_secret:'a10620c85033abd17716cda245'



          Finally post it via post method:



           return new Promise((resolve, reject) => 
          this.http.post(apiUrl, postcredn, options)

          .subscribe(res =>
          resolve(JSON.parse(JSON.stringify(res)));
          console.log('json'+ JSON.stringify(postcredn));

          , (err) =>
          reject(err);
          console.log(apiUrl);
          );
          );


          outputcode






          share|improve this answer

























          • While trying this code. it shows an "TypeError: "postcredn is undefined" " @Utpaul

            – Karthik
            Mar 25 at 5:34












          • can you update your file....

            – Utpaul
            Mar 25 at 5:38











          • Now check @Karthik ...

            – Utpaul
            Mar 25 at 6:09











          • codepen.io/Gokulanathan/pen/JzzGNE please see my code on this link.

            – Karthik
            Mar 25 at 6:12











          • @Karthik i already update my code please check it ...

            – Utpaul
            Mar 25 at 6:13


















          0














          Associative arrays in Javascript are technically Objects and can't be instantiated via new Array(). To create one you can use any of new Object() or . So from the code you posted, you will define it as var postcredn=new Object(); or var postcredn=;



          In your Laravel code, you can access it as you would an associative array in PHP.






          share|improve this answer























            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%2f55312997%2fhow-to-post-associative-array-in-ionic-3%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Please rewrite following code:



            First you need to create interface like:



            export interface Postdata
            username: String;
            password:String;
            grant_type:String;
            client_id: String;
            client_secret: String;



            Then import it and set its value:



            var postcredn:Postdata;
            postcredn=
            username:'karthik@abcde.in',
            password:'05550',
            grant_type:'password',
            client_id:'Outfit1548669',
            client_secret:'a10620c85033abd17716cda245'



            Finally post it via post method:



             return new Promise((resolve, reject) => 
            this.http.post(apiUrl, postcredn, options)

            .subscribe(res =>
            resolve(JSON.parse(JSON.stringify(res)));
            console.log('json'+ JSON.stringify(postcredn));

            , (err) =>
            reject(err);
            console.log(apiUrl);
            );
            );


            outputcode






            share|improve this answer

























            • While trying this code. it shows an "TypeError: "postcredn is undefined" " @Utpaul

              – Karthik
              Mar 25 at 5:34












            • can you update your file....

              – Utpaul
              Mar 25 at 5:38











            • Now check @Karthik ...

              – Utpaul
              Mar 25 at 6:09











            • codepen.io/Gokulanathan/pen/JzzGNE please see my code on this link.

              – Karthik
              Mar 25 at 6:12











            • @Karthik i already update my code please check it ...

              – Utpaul
              Mar 25 at 6:13















            1














            Please rewrite following code:



            First you need to create interface like:



            export interface Postdata
            username: String;
            password:String;
            grant_type:String;
            client_id: String;
            client_secret: String;



            Then import it and set its value:



            var postcredn:Postdata;
            postcredn=
            username:'karthik@abcde.in',
            password:'05550',
            grant_type:'password',
            client_id:'Outfit1548669',
            client_secret:'a10620c85033abd17716cda245'



            Finally post it via post method:



             return new Promise((resolve, reject) => 
            this.http.post(apiUrl, postcredn, options)

            .subscribe(res =>
            resolve(JSON.parse(JSON.stringify(res)));
            console.log('json'+ JSON.stringify(postcredn));

            , (err) =>
            reject(err);
            console.log(apiUrl);
            );
            );


            outputcode






            share|improve this answer

























            • While trying this code. it shows an "TypeError: "postcredn is undefined" " @Utpaul

              – Karthik
              Mar 25 at 5:34












            • can you update your file....

              – Utpaul
              Mar 25 at 5:38











            • Now check @Karthik ...

              – Utpaul
              Mar 25 at 6:09











            • codepen.io/Gokulanathan/pen/JzzGNE please see my code on this link.

              – Karthik
              Mar 25 at 6:12











            • @Karthik i already update my code please check it ...

              – Utpaul
              Mar 25 at 6:13













            1












            1








            1







            Please rewrite following code:



            First you need to create interface like:



            export interface Postdata
            username: String;
            password:String;
            grant_type:String;
            client_id: String;
            client_secret: String;



            Then import it and set its value:



            var postcredn:Postdata;
            postcredn=
            username:'karthik@abcde.in',
            password:'05550',
            grant_type:'password',
            client_id:'Outfit1548669',
            client_secret:'a10620c85033abd17716cda245'



            Finally post it via post method:



             return new Promise((resolve, reject) => 
            this.http.post(apiUrl, postcredn, options)

            .subscribe(res =>
            resolve(JSON.parse(JSON.stringify(res)));
            console.log('json'+ JSON.stringify(postcredn));

            , (err) =>
            reject(err);
            console.log(apiUrl);
            );
            );


            outputcode






            share|improve this answer















            Please rewrite following code:



            First you need to create interface like:



            export interface Postdata
            username: String;
            password:String;
            grant_type:String;
            client_id: String;
            client_secret: String;



            Then import it and set its value:



            var postcredn:Postdata;
            postcredn=
            username:'karthik@abcde.in',
            password:'05550',
            grant_type:'password',
            client_id:'Outfit1548669',
            client_secret:'a10620c85033abd17716cda245'



            Finally post it via post method:



             return new Promise((resolve, reject) => 
            this.http.post(apiUrl, postcredn, options)

            .subscribe(res =>
            resolve(JSON.parse(JSON.stringify(res)));
            console.log('json'+ JSON.stringify(postcredn));

            , (err) =>
            reject(err);
            console.log(apiUrl);
            );
            );


            outputcode







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 25 at 6:41

























            answered Mar 24 at 9:45









            UtpaulUtpaul

            1,2792419




            1,2792419












            • While trying this code. it shows an "TypeError: "postcredn is undefined" " @Utpaul

              – Karthik
              Mar 25 at 5:34












            • can you update your file....

              – Utpaul
              Mar 25 at 5:38











            • Now check @Karthik ...

              – Utpaul
              Mar 25 at 6:09











            • codepen.io/Gokulanathan/pen/JzzGNE please see my code on this link.

              – Karthik
              Mar 25 at 6:12











            • @Karthik i already update my code please check it ...

              – Utpaul
              Mar 25 at 6:13

















            • While trying this code. it shows an "TypeError: "postcredn is undefined" " @Utpaul

              – Karthik
              Mar 25 at 5:34












            • can you update your file....

              – Utpaul
              Mar 25 at 5:38











            • Now check @Karthik ...

              – Utpaul
              Mar 25 at 6:09











            • codepen.io/Gokulanathan/pen/JzzGNE please see my code on this link.

              – Karthik
              Mar 25 at 6:12











            • @Karthik i already update my code please check it ...

              – Utpaul
              Mar 25 at 6:13
















            While trying this code. it shows an "TypeError: "postcredn is undefined" " @Utpaul

            – Karthik
            Mar 25 at 5:34






            While trying this code. it shows an "TypeError: "postcredn is undefined" " @Utpaul

            – Karthik
            Mar 25 at 5:34














            can you update your file....

            – Utpaul
            Mar 25 at 5:38





            can you update your file....

            – Utpaul
            Mar 25 at 5:38













            Now check @Karthik ...

            – Utpaul
            Mar 25 at 6:09





            Now check @Karthik ...

            – Utpaul
            Mar 25 at 6:09













            codepen.io/Gokulanathan/pen/JzzGNE please see my code on this link.

            – Karthik
            Mar 25 at 6:12





            codepen.io/Gokulanathan/pen/JzzGNE please see my code on this link.

            – Karthik
            Mar 25 at 6:12













            @Karthik i already update my code please check it ...

            – Utpaul
            Mar 25 at 6:13





            @Karthik i already update my code please check it ...

            – Utpaul
            Mar 25 at 6:13













            0














            Associative arrays in Javascript are technically Objects and can't be instantiated via new Array(). To create one you can use any of new Object() or . So from the code you posted, you will define it as var postcredn=new Object(); or var postcredn=;



            In your Laravel code, you can access it as you would an associative array in PHP.






            share|improve this answer



























              0














              Associative arrays in Javascript are technically Objects and can't be instantiated via new Array(). To create one you can use any of new Object() or . So from the code you posted, you will define it as var postcredn=new Object(); or var postcredn=;



              In your Laravel code, you can access it as you would an associative array in PHP.






              share|improve this answer

























                0












                0








                0







                Associative arrays in Javascript are technically Objects and can't be instantiated via new Array(). To create one you can use any of new Object() or . So from the code you posted, you will define it as var postcredn=new Object(); or var postcredn=;



                In your Laravel code, you can access it as you would an associative array in PHP.






                share|improve this answer













                Associative arrays in Javascript are technically Objects and can't be instantiated via new Array(). To create one you can use any of new Object() or . So from the code you posted, you will define it as var postcredn=new Object(); or var postcredn=;



                In your Laravel code, you can access it as you would an associative array in PHP.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 23 at 13:10









                Ikenna Anthony OkaforIkenna Anthony Okafor

                376317




                376317



























                    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%2f55312997%2fhow-to-post-associative-array-in-ionic-3%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

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해