我有我的代码
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("form#submit").submit(function() {
// we want to store the values from the form input box, then send via ajax below
var word = $('#word').attr('value');
var sentence = $('#sentence').attr('value');
var email = $('#email').attr('value');
$.ajax({
type: "POST",
url: "/sentence-examples/suggestsentence.php?",
data: "sentence="+ sentence+
"&word="+ word+
"&email="+ email,
success: function(data){
$('form#submit :input').not('input[type="submit"]').val("");
$('div.success').fadeIn();
$('div.success').html(data);
}
});
return false;
});
});
function hide(obj) {
var el = document.getElementById(obj);
el.style.display = 'none';
}
由于什么原因我无法弄清楚“单词”何时包含像“混血儿”这样的连字符,它不会将变量传递给我的脚本。它出现空白。
有什么帮助吗?