Bug Tracker

Ticket #7525 (closed bug: worksforme)

Opened 4 years ago

Last modified 2 years ago

j is null

Reported by: anonymous Owned by: anonymous
Priority: undecided Milestone: 1.5
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocking: Blocked by:

Description

j is null

[Break on this error] - FireBug: l.test(j)){var s=t.getElementsByTagNam...else if(K)for(z in j){if(s.call(j[z],

Change History

comment:1 Changed 4 years ago by addyosmani

  • Owner set to anonymous
  • Status changed from new to pending

Please submit a valid test case that reproduces the issue you are experiencing (ideally on jsFiddle) so that we can investigate this issue further.

comment:2 Changed 4 years ago by lsolova

Hello,

I had same problem, because I create a form on the fly. It seems to me, that this problem is caused by a text area removed from HTML source, but not removed from tinyMCE sources. I found a forum entry about removing:  http://tinymce.moxiecode.com/punbb/viewtopic.php?id=17346 . It works for me.

Bye, Laszlo Solova

comment:3 Changed 4 years ago by addyosmani

  • Status changed from pending to closed
  • Resolution set to worksforme

Closing as no reproducible test case has been provided, despite request. Please feel free to re-open should a valid test case become available

comment:4 Changed 4 years ago by rwaldron

Additionally, please test with a non-minified copy of the source, as this:

[Break on this error] - FireBug: l.test(j)){var s=t.getElementsByTagNam...else if(K)for(z in j){if(s.call(j[z],

...is meaningless.

comment:5 Changed 4 years ago by ajpiano

comment:6 Changed 4 years ago by escamosomix

I think the problem is that jquery is being called twice in the same page... i made a little test writing twice the script declaration of jquery import <script ...></script>

Version 1, edited 4 years ago by escamosomix (previous) (next) (diff)

comment:7 Changed 3 years ago by imaginesamant@…

I agree with escamosomix. I had a similar case. What I did was called two ajax functions to get some json data into two separate array of objects. Then, below these two ajax functions was a simple function that used these two arrays to manipulate a third array using $.each() which would pass through each element of array 1 and array 2. The problem was that the third function would attempt to manipulate the arrays before the ajax functions returned values to them. So, null values passed to $.each and this error popped up.

How did I find this out?

Well, this error would only show up while running application, and not in debug mode. Because in debug mode, I would be using breakpoints and it would provide sufficient time for the ajax functions to calculate the values for this function to use these values.

Solution: The problem states itself clearly. I called the second ajax function in the success option of the first, and the third normal function in the success option of the second so that these functions get called one after another, and not concurrently. Problem solved !! (At least for me).

comment:8 Changed 3 years ago by rwaldron

I've just read through this entire thread and I'm pretty sure that 3 different issues are being discussed. With regard to the most recent comment by imaginesamant: It sounds like you're trying to do synchronous operations on asynchronously created data - you need to use the returned deferred object of $.ajax and pass it to $.when( deferred, deferred, deferred ).then(function() { do this stuff when the async deferreds are _all_ resolved })

comment:9 Changed 3 years ago by anonymous

imaginesamant@… is right.

comment:10 Changed 3 years ago by Ixalmida

I had this problem and solved it thanks to the post by escamosomix. Just thought I'd add a code fragment to help out anyone who is still floundering:

// Get new messages in forum
function forumRefresh() {
    // Script that returns JSON or null
    var url = "forum_refresh.php";

    // Run script
    $.getJSON(url, function(data) {
        // Catch null data error...
        if (data == null)
            return;

        // Now that data != null, the $.each call is okay!
        $.each(data, function() {
            });
        });

Note: ideally, jQuery should give better feedback than "j is null" or just ignore the null value.

Note: See TracTickets for help on using tickets.