Autocomplete with Jquery Question

John S.
John S. used Ask the Experts™
on
I have a text field I am attaching Autocomplete to....

$( function() {
	  // source: "search_invoice_auto"
    $( "#search_quotes" ).autocomplete({
     		source: [ "1144987495", "1144985173", "1144984411" ]
    	});
  } );

Open in new window


I want to POST the values to the url: search_invoice_auto, which will return the appropriate JSON. But I can't figure out how to do this.  The above example works, of course, with the sample data, but I need the data from the url.

Can someone post an example please?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2017
Commented:
Use the post function to send at your page the value that contains the search_quotes like this.The code that i write triggered via click a button but you can set another event to do the following:

$("button").click(function(){
    var searchValue=$( "#search_quotes" ).val();
    $.post("search_invoice_auto.php",
    {
        name: 'searchValue'        
    },
    function(data, status){
        alert("Data: " + data + "\nStatus: " + status);
    });
});

Open in new window

John S.Web Developer

Author

Commented:
Perfect! Thanks so much.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial