Thanks for the continued help Rob, I am getting there slowly and I
hope I wont be pestering you for too much longer :)
Ok, so using
data: function(start, end, callback) {
var s = start.getTime();
var e = end.getTime();
$.get("sections/calendar/get_events.ajax.php", { start: s, end:
e },
function(result) {
if(result!="") {
callback(result);
} else {
callback([]);
}
});
}
and having the php return
[{"id":1, "start":"2009-11-27T13:15:00.000+00:00",
"end":"2009-11-27T14:15:00.000+00:00", "title":"Lunch with Mike"}]
exactly the same return as
data: "sections/calendar/get_events.ajax.php" (which recieves and
displays the events perfectly)
results in
G is undefined
[Break on this error] (function(){var
l=this,g,y=l.jQuery,p=l....each(function(){o.dequeue(this,E)})}});\n
which you are right is a jquery error on line 12, the very start of
jquery.
So... rearranging things a little...
data: function(start, end, callback) {
var s = start.getTime();
var e = end.getTime();
$.get("sections/calendar/get_events.ajax.php", { start: s, end:
e },
function(result) {
if(result!="") {
var r = {events:[{"id":1,
"start":"2009-11-27T13:15:00.000+00:00",
"end":"2009-11-27T14:15:00.000+00:00", "title":"Lunch with Mike"}]};
callback(r);
} else {
callback([]);
}
});
}
Works perfectly, which leads me to believe that whatever im passing
back in the callback isnt a proper js object, somehow. So...
data: function(start, end, callback) {
var s = start.getTime();
var e = end.getTime();
$.get("sections/calendar/get_events.ajax.php", { start: s, end:
e },
function(result) {
alert(result);
if(result!="") {
var r = {events:[result]};
callback(r);
} else {
callback([]);
}
});
}
and no matter what the php returns, whether its
[{"id":1, "start":"2009-11-27T13:15:00.000+00:00",
"end":"2009-11-27T14:15:00.000+00:00", "title":"Lunch with Mike"}]
or
{"id":1, "start":"2009-11-27T13:15:00.000+00:00",
"end":"2009-11-27T14:15:00.000+00:00", "title":"Lunch with Mike"}
or simply a string of
test
results in firebug complaining on line 1141
d is undefined
[Break on this error] return new Date(d.getTime());\r\n
so I still think the object isnt constructed properly.
To clarify the js is recieving the php GET string. But how do i turn
this into an object that the callback understands?
Thanks so much if you can help me get any nearer to solving this!
On Nov 25, 2:57 am, Rob Monie <
robmo...@gmail.com> wrote:
> That looks like a jquery issue so i'm not sure what's causing it. I would
> recommend using a get instead of a post for retrieving your data. This is a
> better use of the http methods as you're not posting form data, rather
> you're retrieving resources.
>
> I don't think this has anything to do with your problem though. Can you
> debug it more and figure out the exact line that's causing this ? I think
> it's just a processing off elimination that's needed to isolate the
> problematic code. There's nothing that you're trying to do that should be a
> problem so it'll be something basic I think.
>