我使用了引导模态形式,我正在尝试以这种方式使用"get"方法获取值,但它不起作用。谁能告诉我如何使用 AJAX。如果可以不用AJAX,那对我非常有帮助。
<div class='modal fade' id='editButtonModal' role='dialog'>
<div class='modal-dialog'>
<div class='modal-content' >
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal'>×</button>
<h4 style="color:red; text-align:center">My Article</h4>
</div>
<div class='modal-body'>
<form role='form_edit' action="addArticle.php" method="get">
<div class="form-group">
<label for="Title" >Title</label>
<input type="text" class="form-control" id="titleId" name='tit' placeholder="Enter the title of the article">
</div>
<div class="form-group">
<label for="ArticleContent">Your Thoughts!</label>
<textarea class="form-control" rows='10' id="artcleContentId"></textarea>
</div>
<button type="submit" class="btn btn-default btn-success btn-block" >Submit</button>
</form>
</div>
</div>
</div>
</div>
php 文件:
echo "hello world"
echo $_GET['tit']
这是 PHP 文件中的错误。你丢失了分号。
它应该是:
echo "hello world";
echo $_GET['tit'];