http://www.kupe.nl/badkamer3.htmljQuery函數返回undefined?爲什麼?
我不能讓這種在線代碼啄allong,只是不會讓一個代碼塊。)
jQuery函數loadingAjax()是不確定的?當所有的收音機都被填入時,這個動作被調用。這個表單的一部分被另一個函數收回。
如果你想參加測試
選擇「紐約」模型。並進行填寫表格..和提交按鈕
請幫幫忙,
感謝
JS代碼:
<script type="text/javascript">
$(document).ready(function(){
$("#ptmodel label").click(function() {
var mainImage = $(this).attr("name");
var targetRadio = $(this).attr("for");
$("#main_image img").attr({ src: 'http://www.kupe.nl/media/privatetime/images/smaller/' + mainImage + '.jpg' });
$("#" +targetRadio).attr("checked", "checked");
var selected = mainImage;
var selecteddataString = 'in_pt_model_label='+ selected;
$.ajax({
type: "POST",
url: "badkamer_sets.php",
data: selecteddataString,
success: function(selected){
$("#ptsize_check").html(selected);
}
});
});
function loadingAjax(my_div){
var size = $('input:radio[name=in_pt_artikel]:checked').val();
var color = $('input:radio[name=in_pt_color]:checked').val();
var model = $('input:radio[name=in_pt_model]:checked').val();
if(model == '' || model == null){
$('#ptmodel_check').html('<font color="red">Selecteer een Model a.u.b</font>');
}
if (size == '' || size == null){
$('#ptsize_check').html('<font color="red">Selecteer een Opstelling a.u.b</font>');
}
if (color == '' || color == null){
$('#ptcolor_check').html('<font color="red">Selecteer een Front a.u.b</font>');
}
else {
var dataString = 'in_pt_model='+ model + '&in_pt_color=' + color + '&in_pt_artikel=' + size;
//$("#"+div_id).html('<img src="ajax-loader.gif"> saving...');
$('#pt_form').hide();
$('#'+my_div).html('<img src="ajax-loader.gif"> Een moment geduld alstublieft...');
$.ajax({
type: "POST",
url: "badkamer_submit.php",
data: dataString,
success: function(msg){
window.location="http://www.box7shop.nl/" + msg +".html";
}
});
}
}
});
</script>
(日Thnx EVERONE的答覆)
我我的問題像這樣解決了:
$(document).ready(function(){
$("#ptmodel label").click(function() {
var mainImage = $(this).attr("name");
var targetRadio = $(this).attr("for");
$("#main_image img").attr({ src: 'http://www.kupe.nl/media/privatetime /images/smaller/' + mainImage + '.jpg' });
$("#" +targetRadio).attr("checked", "checked");
var selected = mainImage;
var selecteddataString = 'in_pt_model_label='+ selected;
$.ajax({
type: "POST",
url: "badkamer_sets.php",
data: selecteddataString,
success: function(selected){
$("#ptsize_check").html(selected)
}
});
});
$("#submitimg").live("click", function() {
var size = $('input:radio[name=in_pt_artikel]:checked').val();
var color = $('input:radio[name=in_pt_color]:checked').val();
var model = $('input:radio[name=in_pt_model]:checked').val();
if(model === '' || model === null){
$('#ptmodel_check').html('<font color="red">Selecteer een Model a.u.b</font>');
return false;
}
if (size === '' || size === null){
$('#ptsize_check').html('<font color="red">Selecteer een Opstelling a.u.b</font>');
return false;
}
if (color === '' || color === null){
$('#ptcolor_check').html('<font color="red">Selecteer een Front a.u.b</font>');
return false;
}
else {
var dataString = 'in_pt_model='+ model + '&in_pt_color=' + color + '&in_pt_artikel=' + size;
//$("#"+div_id).html('<img src="ajax-loader.gif"> saving...');
$('#pt_form').hide();
$('#myDiv').html('<img src="ajax-loader.gif"> Een moment geduld alstublieft...');
$.ajax({
type: "POST",
url: "badkamer_submit.php",
data: dataString,
success: function(msg){
window.location='http://www.box7shop.nl/' + msg + '.html';
}
});
}
});
});
請在問題中發佈任何相關代碼,而不是直接指向外部網站。 – Xion
適用於Chrome的作品 – Mrchief
適用於Firefox。你使用的是什麼瀏覽器? – locrizak