0

I have an html container button and input for string search.

I want to create HTTP POST request using RESTful. The request needs to contain the data the user inserted in the input.

<div class="search">
    <div class="cui__input giant">
        <label class="cui__input__label">
            Type your search query
        </label>
        <div>
            <input type="button" value="Submit" />
        </div>
        <input class="cui__input__input" />
    </form>
</div>

I can use JavaScript or JQuery.

How do I need to preform the request?

RamenChef
  • 5,557
  • 11
  • 31
  • 43
  • 2
    "or jquery"? jquery is written IN javascript. there's nothing in jquery that can't be done in plain javascript. jquery is just a bunch of (highly) useful helper functions. – Marc B Sep 14 '16 at 16:43
  • This question has been already answered here: http://stackoverflow.com/questions/5004233/jquery-ajax-post-example-with-php – Luke Sep 14 '16 at 16:46

1 Answers1

0

http://jsbin.com/xidena/edit?html,js,output
You can using the XMLHttpRequest function,and then using the innerHTML function to change the HTML content of your "showing" container

Felix Fong
  • 969
  • 1
  • 8
  • 21