0

Here is a snippet of code from one of my newer html projects:

<form action='https://www.Bing.com/' method='PUT'>
  <div>
    <label for='newTab'>New Tab?</label>
    <input type='checkbox' name='newTab' id='newTab'/>
  </div>
  <div>
    <label for='newTab'>What do you want to search?</label>
    <input name='/search?q=' id='/search?q=' value='Shopping' />
  </div>
  <div>
    <button>Search</button>
  </div>
</form>

What it's supposed to do is interact with the Bing API and return the search specified-for example here I want to generate a search for "shopping", I took two values from the Bing API- the 'newTab' value and the '/search?q' value to send the information to, but when I send the information, instead of displaying the search bar with "shopping", it displays the Bing homepage.

As you may be able to tell, I'm new to using APIs at all, especially in HTML-- could anybody help me debug this?

1 Answer 1

0

Assuming your form is inside the iframe, this should do the trick.

<form action='https://www.Bing.com/search' method='GET'>
  <div>
    <label for='newTab'>New Tab?</label>
    <input type='checkbox' name='newTab' id='newTab'/>
  </div>
  <div>
    <label for='search'>What do you want to search?</label>
    <input name='q' id='search' value='Shopping' />
  </div>
  <div>
    <button>Search</button>
  </div>
</form>

Also you can read up on some documentation here: https://www.w3schools.com/tags/att_form_method.asp

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.