AJAX Post objects

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blyxx86
    Contributor
    • Nov 2006
    • 258

    AJAX Post objects

    Hey everyone,

    I'm fairly new to javascript. I hardly ever use it, but my newest project is demanding that I have 'dynamic' drop downs where the user can type in their partial matches.

    So, I come across jQuery Autocompletes. Works wonderful, except the framework I am using doesn't like using GET methods and they are less safe than POST data.

    So I modified the code of the autocomplete to allow me to send POST data, but I am now stuck getting multiple pieces of POST data to pass to the page. Can someone help me?

    Code:
    $.post(options.url, {p:q}, function(data) {
    				data = parseData(data);
    				//addToCache(q, data);
    				receiveData(q, data);
    			});
    
    
    options.extraParams = options.extraParams || {a:1,b:2}; // for example
    How would I pass both {p:q} and options.extraPa rams to the $.post function?

    I have tried {p:q} + options.extraPa rams but that only posts "[object Object][object Object]"

    any help would be appreciated.

    Thank you!
  • blyxx86
    Contributor
    • Nov 2006
    • 258

    #2
    Hey everyone!
    I found a solution to the problem.

    jQuery had a built-in function to do just this. My lack of knowledge of what the objects are called made it difficult to define a decent enough search for my purpose.

    A few texts between a friend and me helped me define the words for my search and expand the thought.

    Associative arrays in javascript appear to be called objects. Their values are properties. Below is the code that allows the merge to take place.


    Code:
    var settings = { validate: false, limit: 5, name: "foo" };
    var options = { validate: true, name: "bar" };
    jQuery.extend(settings, options);

    Comment

    Working...