Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9189121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:10:26+00:00 2026-06-17T20:10:26+00:00

I am trying to combine ajax request with an autocomplete function. But it seems

  • 0

I am trying to combine ajax request with an autocomplete function. But it seems something is wrong for the autocomplete. I am using this to implement my code.

The console gives me back something like : http://domain.com/[%22...array from ajax here]?term=What i put in my input pointing a 403 error -.-

I am a bit lost though it seemed simple to me.

  <script type='text/javascript'>
      $("input[name=search]").on('keyup', function(){
         jQuery.ajax({
           type: 'POST', // Le type de ma requete
           <?php echo "url: '".PTC.ROOT.DS."ajax'"; ?>, // URL to call (works)
           data: {
             search: ''+$("input[name=search]").val()+''
           }, 
           success: function(data, textStatus, jqXHR) {

             window.availableNames = data; //JSON format
             $(function() {
              alert(window.availableNames); //Show the JSON encoded table with the right result.

              $("input[name=search]").autocomplete({source: window.availableNames}); // Fails.
             });
           },
           error: function(jqXHR, textStatus, errorThrown) {
           }
         });
      });
      </script>

Thank you

EDIT : Separately Ajax works, and Autocomplete works. But when I try to incorporate the second in the first, it doest.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:10:28+00:00Added an answer on June 17, 2026 at 8:10 pm

    Autocomplete has the option to provide an url as the source-parameter

    When a String is used, the Autocomplete plugin expects that string to point to a URL resource that will return JSON data. It can be on the same host or on a different one (must provide JSONP). The Autocomplete plugin does not filter the results, instead the request parameter “term” gets added to the URL, which the server-side script should use for filtering the results. The data itself can be in the same format as the local data described above.

    So make sure the api endpoint located at the supplied url returns json and reacts correctly to the ‘term’ parameter.

    This way you don’t have to fiddle with your own ajax calls.

    So you autocomplete code would look something like this:

    $("input[name=search]").autocomplete({source: '<?php echo PTC.ROOT.DS."ajax"; ?>'});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tried using merge and extend to combine arrays inside an Autocomplete ajax option
I'm trying to do something that seems like it should be easy but I'm
I'm trying to combine code on two branches with the 'git merge' command, but
I am trying to combine using a std::set and a class, like this: #include
I'm trying to combine matching something like: $(.item).each(function(i) { //animation here }); with jQuery's
I am trying to combine two images into one. This is the code I
I'm trying to combine the WCF Routing Service with Discovery but it seems that
im trying to combine two images into a single image. unfortunately this has to
I'm trying to combine both the result of a semantic and a dictation request
I'm trying to combine 4 input fields into a jQuery function so that it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.