Помогите, пожалуйста, найти ошибку в java-скрипте

[Удален]
597

Здравствуйте все!

В общем у меня засада в одном отрезке java скрипта. Я пока не очень силён в этом, а потому и парюсь.. Помогите, пожалуйста разобраться!

В общем схема обычная

страница.php -> script.js -> обработчик.php -> страница.php

..собственно я вношу изменения в существующий скрипт, мне нужно занести новые данные, которые передаются через checkbox..

Ниже я приведу 2 отрезка кода: оригинал и с изменениями:

Это рабочее:

$('input.savenewnewplanname').click(function(){ 

planid1=$(this).attr('id');
$('input.newnewplanname').each(function(){
planid2=$(this).attr('id');
if (planid1==planid2)
{
newname=$(this).val();
$('select.newplantype').each(function(){
planid3=$(this).attr('id');
if (planid1==planid3)
{
newtype=$(this).val();
$('select.newplansquare').each(function(){
planid4=$(this).attr('id');
if (planid1==planid4)
{
newsquare=$(this).val();
$('input.newplanmaterial').each(function(){
planid10=$(this).attr('id');
if (planid1==planid10)
{
a = $(this).attr('idid');
b = $(this).attr('checked');
if (a==1) { x1=a; y1=b; }
if (a==3) { x3=a; y3=b; }
if (a==4) { x4=a; y4=b; }
}
});
$.get('/savenewplanname.php', { 'newname': newname, 'planid':planid1, 'newtype':newtype, 'newsquare':newsquare, 'y1':y1, 'y3':y3, 'y4':y4}, function(data){

$('p.newplannamee1').each(function(){
planid5=$(this).attr('id');
if (planid5==planid1)
{
$(this).hide();
$('p.newplannamee').each(function(){
planid6=$(this).attr('id');
if (planid6==planid1)
{
$(this).show();
$(this).text('');
$(this).append(data);
}
});
}
});
});
}
});
}
});
}
});
});

Это с изменениями:

$('input.savenewnewplanname').click(function(){ 

planid1=$(this).attr('id');
$('input.newnewplanname').each(function(){
planid2=$(this).attr('id');
if (planid1==planid2)
{
newname=$(this).val();
$('select.newplantype').each(function(){
planid3=$(this).attr('id');
if (planid1==planid3)
{
newtype=$(this).val();
$('select.newplansquare').each(function(){
planid4=$(this).attr('id');
if (planid1==planid4)
{
newsquare=$(this).val();
$('input.newplanmaterial').each(function(){
planid10=$(this).attr('id');
if (planid1==planid10)
{
a = $(this).attr('idid');
b = $(this).attr('checked');
if (a==1) { x1=a; y1=b; }
if (a==3) { x3=a; y3=b; }
if (a==4) { x4=a; y4=b; }
$('input.newplanother').each(function(){
planid20=$(this).attr('id');
if (planid1==planid20)
{
c = $(this).attr('id2');
d = $(this).attr('checked');
if (c==1) { x5=c; y5=d; }
}
});
$.get('/savenewplanname.php', { 'newname': newname, 'planid':planid1, 'newtype':newtype, 'newsquare':newsquare, 'y1':y1, 'y3':y3, 'y4':y4, 'y5':y5 }, function(data){

$('p.newplannamee1').each(function(){
planid5=$(this).attr('id');
if (planid5==planid1)
{
$(this).hide();
$('p.newplannamee').each(function(){
planid6=$(this).attr('id');
if (planid6==planid1)
{
$(this).show();
$(this).text('');
$(this).append(data);
}
});
}
});
});
}
});

}
});
}
});
}
});
});

Здесь я добавляю:

$('input.newplanother').each(function(){ 

planid20=$(this).attr('id');
if (planid1==planid20)
{
c = $(this).attr('id2');
d = $(this).attr('checked');
if (c==1) { x5=c; y5=d; }
}
});

Ну и передачу новой переменной y5.

Вся странность в том, что сначала это работает, а потом просто отрубается... Кнопка подтверждения изменения не реагирует на нажатие и всё.. Стоит вернуть всё к первоначальному виду и снова работает, но, естественно, без нужного добавленного условия..

В чём моя ошибка?

J
На сайте с 23.08.2007
Offline
15
#1

Дайте ссылку на демонстрационную страницу, тогда можно будет попробовать посмотреть.

[Удален]
#2
Jameson:
Дайте ссылку на демонстрационную страницу, тогда можно будет попробовать посмотреть.

ммм, это уже сложнее, дело в том что страница находится в ЛК пользователя в разрабатываемом сайте..

Если нужно что-то подробнее описать - я сделаю..

L2
На сайте с 07.05.2008
Offline
74
#3

1. Это не Java а Javascript.

2. Руки отрывать программеру у которого такой уровень вложенности сделан для проверки данных с переменными типа planid1, planid2 .. planid5.

RU домены в WebNames по 100 руб. Оптом скидки.

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий