Here is what I am using so far:
var details = $('<div id="journal_edit" class="modal-popup" />')
On trying this, I get an empty dialog box--like the view skips rendering the template, but with no JS errors. I realize that the .dialog() function runs separately from the deferreds, so I tried using $.when( ... ).then( ... ); but also no render or response, or a JS error. The models seem to be returning like they should, but the view rendering basically doesn't seem to happen after the model calls.
Do you see in Firebug that the requests being made properly? I remember that there was something with Controller.View and Deferreds but from what I could see it should work as any other way of calling $.View.
The two models do load the AJAX calls, and the models both have "return" on the .ajax() call, but nothing seems to load. I tried a test console.log() call, but that does not trigger in spite of the two AJAX calls loading with a "200 OK" status in Firebug. Strange...
Here's what I've been trying so far now, with the test console log:
I might have at some point tried just using .html without this.view, but I can try again.
The problem though would still remain in any case--whatever happens inside $.when( [...] ).then( /* stuff happens, like console.log('hello'); */ ) does not actually happen after the model calls are made in the $.when( ) function. I should get a console message, even if the view does not work, but that does not happen. I believe I have the standard JMVC 3.1 distribution, but I don't know if I have a screwed up jquery install or something.
Ok... my apologies. I think I could have saved myself a bit of trouble if I had a proper 'error' callback to notify me something was wrong with the JSON response. Basically, I wasn't properly returning my JSON results from my ASP script which didn't have the right headers, and also utilized single quotes instead of double quotes. No wonder nothing showed!
Anyway, this problem is solved now, and I FINALLY understand deferreds the way they are supposed to work. Thanks again for the support, everyone!
Leave a comment on jonandrewgreig's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic