quirkey / sammy

Sammy is a tiny javascript framework built on top of jQuery, It's RESTful Evented Javascript.
http://sammyjs.org
MIT License
2.99k stars 384 forks source link

Problem with partial rendering #33

Closed mikespokefire closed 13 years ago

mikespokefire commented 13 years ago

Seem to be having an issue with rendering a partial, it just seemingly stops half way through with no error messages or reasons.

item.template contains <%= title %> to

this.get('#/', function() {
    var event_context = this;
    event_context.partial('/templates/item.template', { "title": "Hello!" });
}

After poking around for a while it seems to be stemming from the success call on line 1391, for some reason success is never trigged unless I monkey patch the code to have an ajax option of:

dataType: 'plain'

In order to get around this problem I've had to create a helper for rending partials that calls this:

event_context.load(location, { dataType: "plain" })
    .interpolate({ "data": data}, location)
    .then(function(content) {
        event_context.swap(content);
    });

But this feels very hacky just to get a partial rendering, is there a bug here or am I just doing something wrong?

Cheers, Michael

quirkey commented 13 years ago

Hey Michael: what browser/version are you using? Is this happening locally or on a server?

mikespokefire commented 13 years ago

Using Firefox 3.6.8 and running from a local sinatra server

mikespokefire commented 13 years ago

Any news on this?

quirkey commented 13 years ago

hey mikespokefire

Can you check from master again? Another user was also reporting issues with using JSON-P and Firefox 3.6.8 but I dont know if these are related.

--AQ

mikespokefire commented 13 years ago

Whatever you did worked like a charm!

Can confirm all working from master and my problem has been solved, many thanks for taking a look at that!

Sammy is fantastic and is doing exactly what I wanted.