我尝试了各种解决方案,但没有一个适合我的特殊情况!我怎样才能这样做,以便当用户按下'Enter'时,表单提交和搜索.
顺便说一下,我正在使用带有AJAX的烂番茄API.
形成
<form name="myform" action="" method="GET"><h3 class="white">Search for a movie here!:</h3><br>
<input type="text" id="inputbox" value="">
<input type="button" id="button" value="Go!" onClick="filmlist(this.form)">
</form>
Run Code Online (Sandbox Code Playgroud)
ajax.js
function filmlist(form) {
$('#films table').empty(); //removes previous search results before adding the new ones.
var apikey = "APIKEY";
var baseUrl = "http://api.rottentomatoes.com/api/public/v1.0";
var moviesSearchUrl = baseUrl + '/movies.json?apikey=' + apikey;
var query = form.inputbox.value; //uses the value from the input box as the query search
$(document).ready(function () {
// sends the query
$.ajax({
url: moviesSearchUrl + '&q=' …Run Code Online (Sandbox Code Playgroud) 如何以有效的方式以编程方式在视图控制器之间切换?我目前正在使用:
ViewController *viewController = [[ViewController alloc] init];
[self presentViewController:viewController animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
但是,这不显示我使用界面构建器插入的项目.只有我以编程方式插入的项目.
我希望这样做,因为我想在每个页面上显示一个主页按钮.