调试PHP / JS的CI Web应用程序应用程序、JS、PHP、Web

2023-09-10 20:08:31 作者:醉卧

我还以为我是做伟大的这个Web应用程序我工作,但很可惜......我开始觉得我设计的不好,即使我开始喜欢上6倍,同时学习了CI框架。

I thought I was doing great with this web app I'm working on, but alas.. I'm starting to think I designed it poorly, even though I started over like 6 times while learning the CI framework.

该应用程序是这里和我的问题是:当你去,例如,2011年12月31日(由pressing向右的箭头,然后单击第31号),你会得到一些红色的错误,我的表头(页的第二部分)发疯。这样做之后,你应该尝试要回说.. 4月1日,你会看到,我的头去更加疯狂,通过一些东西,我不知道它是从哪里来的循环。如果你到4月2日以后,你会看到它还是通过循环的东西,即使它不应该。

The application is here and my problem is as follows: when you go to, for example, december 31 2011 (by pressing the right arrow then clicking on the 31st), you get some red errors and my table headers (second part of the page) go crazy. After doing that, you should try going back to say.. april 1, you'll see that my headers go even more crazy, looping through some stuff that I don't know where it's coming from. If you go to april 2nd then, you'll see it still loops through that stuff, even though it shouldn't.

我不知道如何调试这一点,我甚至不知道问题出在哪里:在我的AJAX调用或我的PHP code。

I'm not sure how to debug this, I don't even know where the problem lies: in my AJAX call or my PHP code.

我的源$ C ​​$ C可以发现这里。涉及的文件有:

My source code can be found here. The files involved are:

/logic/controllers/planner.php
/logic/models/planner_model.php
/logic/views/planner/days_content.php
/logic/views/planner/detail_content.php

会有人这么样来看待这一点,并帮我在这里找到了问题?我真的不知道到哪里寻找解决这一问题。我可以提供有关如何我的申请工作,如果需要更多的信息。

Would anyone be so kind to look at this and help me find the problem here? I'm honestly not sure where to look for the solution to this issue. I can provide more information about how my application works if necessary.

我基本都存放在数组中,并传递给视图。当我做一个AJAX调用,我更新数组再加载,视图,使用的.html()之后,我将它传递到我的网页。

I basically store everything in an array, and pass that to the view. When I do an AJAX call, I update the array and load the view again, after which I pass it into my page using .html().

多谢了。

推荐答案

您可以使用Firebug的Firefox来调试AJAX / JavaScript的。当我点击日期有多个Ajax调用。我认为它的发生,因为你有内部dates_content.php它被载入单击左/右箭头每次JS click处理程序。所以,你的日期有多个与之相关点击处理程序。

You can use firebug for firefox to debug ajax/javascript. When I click on a date there are multiple ajax calls. I think its happening because you have the js click handler inside dates_content.php which gets loaded every time you click right/left arrow. So your dates have multiple click handlers associated with it.

$("#day_list li").live("click", function() {
$(".selected").removeClass("selected");
var day = $(this).attr('value');
$(this).addClass('selected');
$.ajax({
type: "POST",
url: "/planner/change_detail",
data: { day: day, month: current_month, year: current_year },
success: function(data)
{
$("#detail_content").html(data);
}
})
});

我说的上述code你有

I am talking about the above code you have

 
精彩推荐
图片推荐