Fabio,

I tried that too. Its still not working. I also tried to inject a
'div' in a completely different part of the page and it failed there
too. So I don't think it has anything to do with the JSON response.

I also added one

alert("appending " + element.id +" at " + context.id);

statement in "var inserters bottom" function in mootools.js file and
IE responded back with correct element.id and context.id. So it seems
IE is able to identify the element and the context, just not able to
do "element.appendChild(context)"

I have checked every ( for a matching ) and every { for a matching }.
Also made sure that there are no extra commas after the last  elements
of arrays. Is there an equivalent of "developer extension in FF"
available in IE so that we can debug these issues?

Here is my complete code ....

Really appreciate your time on this.... :)

Sudheer
=========================================================================================
var updateAction2 = function(item,method) {

    switch(item) {
        case "GAME" :
            url = "gameUpdate.php";
            break;
         case "VENUE" :
            break;
    }

    var ajaxRequest = new Request.JSON({
        url: url,
        method: 'get',
        onSuccess: function(responseText) {
            // Lets build the table
            // Main div
            var gameLayout = new Element('div', {
                'id': 'gameLayout'
                });
            gameLayout.inject($('rghtWrkCntnr'));

            // main Table
            var gameTable = new Element('table', {
                'id': 'gameTable'
                });
            gameTable.inject($('gameLayout'));

            // Heading Row
            var headRow = new Element('tr', {
                'id': 'gameTableHeadRow'
                });
            headRow.inject($('gameTable'));

            var mainHeading = new Element('th', {
                'id': 'gameTableMainHead',
                'text': "Game Information",
                'colspan': '5'
                });
            mainHeading.inject($('gameTableHeadRow'));

            // Build the column heads
            var headRow = new Element('tr', {
                'id': 'gameTableSubHeadRow'
                });
            headRow.inject($('gameTable'));

            var heads = new Array('Game', 'Game Date', 'Visitor Team',
'Reserve Price');
            heads.each(function(heading, index) {
                var headCell = new Element('th', {
                    'class': 'gameTableHeadCell',
                    'text': heading
                });
                headCell.inject($('gameTableSubHeadRow'));
            });

            // Now build each row

            var fields = new Array("GameDate", "VisitorId",
"ReservePrice");
            responseText.each(function(game,index) {
                var bodyRow = new Element('tr', {
                    'id': 'gameTableBodyRow'+index+1
                    });
                bodyRow.inject($('gameTable'));

                // Game sequence number in first column
                var bodyCell = new Element('td', {
                    'id': 'gameTableBodyRowGame'+index+1,
                    'text': index+1
                    });
                bodyCell.inject($('gameTableBodyRow'+index+1));

                // Game fields in remaining columns
                fields.each(function(field,id) {
                    var bodyCell = new Element('td', {
                        'id': 'gameTableBodyRow'+field+index+1,
                        'text': game[field]
                        });
                    bodyCell.inject($('gameTableBodyRow'+index+1));
                    });
            });
        }
    }).send();
}

On Jul 31, 11:55 am, Fábio M. Costa <[email protected]> wrote:
> oh i see the problem now hehe
>
> Try this:
>  var ajaxRequest = new Request.JSON({
>        url: url,
>        method: 'get',
>        onSuccess: function(responseText) {
>            // Lets build the table
>            var gameLayout = new Element('div', {
>                'id': 'gameLayout'
>             });
>            gameLayout.inject($('rghtWrkCntnr'));
>        *} // <- this used to have a ');' which is wrong*
>  });
>
> But it should've give you an error on firefox, i dont understand how it was
> working...
>
> --
> Fábio Miranda Costa
> Solucione Sistemas
> Front-End Engineerhttp://meiocodigo.com
>
> On Fri, Jul 31, 2009 at 3:23 PM, Sudheer <[email protected]> wrote:
>
> > Hi Fabio,
>
> > Here is how the json looks like as sent by the server side php
> > json_encode function. I am able to decode it using mootools json
> > decode... No problems there (actually I love the way mootools does
> > it). I rewrote the code as per previous post and still just not able
> > to create a new div element.
>
> > [{"GameDate":"2010-01-01","VisitorId":"2","ReservePrice":"101"},
> > {"GameDate":"2010-01-02","VisitorId":"2","ReservePrice":"103"}]
>
> > Thanks
> > Sudheer
>
> > On Jul 31, 10:49 am, Fábio M. Costa <[email protected]> wrote:
> > > Hi Sudheer, could you tell us whats the json your getting on the
> > > responseText variable?
> > > And please rewrite the code with the previous fix, so it will be easier
> > to
> > > help.
> > > Welcome to Mootools!
>
> > > Cheers,
>
> > > --
> > > Fábio Miranda Costa
> > > Solucione Sistemas
> > > Front-End Engineerhttp://meiocodigo.com
>
> > > On Fri, Jul 31, 2009 at 2:10 PM, Sudheer <[email protected]> wrote:
>
> > > > Oh ... I was trying to figure out if I am receiving the JSON data
> > > > correctly or not. I have removed it and it still does not work.
> > > > Unfortunately IE is not giving any error either. It just skips over
> > > > the part of the code. I want to add a div and then add a dynamically
> > > > generated table in it. One set of json data will provide the table
> > > > headings and another set will provide the data itself and then I will
> > > > generate the table dynamically. However, I am stuck at inserting the
> > > > first div only.
>
> > > > Thanks
> > > > Sudheer
>
> > > > On Jul 31, 9:32 am, Ryan Florence <[email protected]> wrote:
> > > > > I really doubt this has anything to do with it ... but what's up
> > with:
>
> > > > > responseText.each(function(game,index) {
>
> > > > > });
>
> > > > > On Jul 31, 2009, at 10:24 AM, Sudheer wrote:
>
> > > > > > Hi Friends,
>
> > > > > > I am a newbie to Mootools and to this group. I am learning Mootools
> > > > > > and it has been a good ride so far. However I am stuck and would
> > > > > > appreciate any help on this matter. Here is a small piece of code
> > that
> > > > > > is not working in IE6 & 7 (works fine with Firefox). I can create
> > the
> > > > > > elements in IE using createElement and appendChild methods.
>
> > > > > >    var ajaxRequest = new Request.JSON({
> > > > > >        url: url,
> > > > > >        method: 'get',
> > > > > >        onSuccess: function(responseText) {
> > > > > >            responseText.each(function(game,index) {
> > > > > >            });
> > > > > >            // Lets build the table
> > > > > >            var gameLayout = new Element('div', {
> > > > > >                'id': 'gameLayout'
> > > > > >                });
> > > > > >            gameLayout.inject($('rghtWrkCntnr'));
> > > > > >        });
> > > > > >    });
>
> > > > > > Am I missing something? Please help
>
> > > > > > Thanks and Cheers
> > > > > > Sudheer

Reply via email to