GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes Jquery-Ajax:- How to pass nested parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Jquery-Ajax:- How to pass nested parameters" Watch "Jquery-Ajax:- How to pass nested parameters" New topic
Author

Jquery-Ajax:- How to pass nested parameters

Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 637
Hi,

can some one tell me syntax to pass nested parameters to $.ajax ? following is my code

now question is how to i pass it to following $.ajax call ?



All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61309
    
  66

Sorry, but I'm not really sure what you are asking.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 637
ok one more try

I call AutoText Function with following parameters,note queryString is nested parameter.

$("#AutoComplete").AutoText("getData.jsp",{minSearhChars:3,queryString:{accountKey:1,someKey:10}});

my AutoText functions looks like this



question is how do i pass the queryString to ajax call so that values of accountKey and somekey are passed to jsp.

I can hardcode it as data:{where:value,accountKey:queryString["accountKey"]..}

but i want it in plugin so needs a dynamic solution.

-P
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61309
    
  66

Still not sure, but are you asking how to merge the object in options.queryString with the object {where: value} so that all three parameters are submitted to the Ajax request?

If so, investigate the $.extend() utility function.
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 637
my bad tats was dum question sorry for the confusion, yes $.extend was the option.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61309
    
  66

Why was it a dumb question? I think not.
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 637
with so much time spent on jq i should have figured it out .

neways..

-P
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Jquery-Ajax:- How to pass nested parameters