PDA

View Full Version : Cannot load javascript file in MVC model



hieu79vn
13 Jun 2012, 4:00 AM
hello,

I use MVC in ASP.NET with user control. Because the usercontrols are loaded dynamically so the path to javascript is changed like below

Resource interpreted as Script but transferred with MIME type text/html: "http://localhost/abc/page.aspx/en/bbb/process/12485/app/controller/ThreadLists.js?_dc=1339583137852 (http://localhost/buyer_technip/page.aspx/en/bpm/process_manage/12485/app/controller/ThreadLists.js?_dc=1339583137852)".

Could I set fixed path for chaque .js file in model, view and control?

Merci

jay@moduscreate.com
13 Jun 2012, 4:37 AM
ideally, you want them documented in the requires, stores, views and models arrays so when you go to production, your app will concatenate properly.

hieu79vn
13 Jun 2012, 4:59 AM
Thank you for your answer but even I do (in app.js)
requires: ['Abc.controllers.ThreadLists','Abc.controllers.Organisations'],
instead ofcontrollers: [
'ThreadLists',
'Organisations'
],
the error is still there. Is there another solutions?

scottmartin
13 Jun 2012, 3:00 PM
. Because the usercontrols are loaded dynamically

Are you using any 3rd party JS to load dynamically?

If this is not the case, then please review the following:
http://www.sencha.com/learn/the-mvc-application-architecture/

You may have something wrong.

Scott.

hieu79vn
13 Jun 2012, 10:51 PM
Hi Scottt,

You are right. I use a third party platform for .NET. Do you have any solution for this?

Thanks

scottmartin
14 Jun 2012, 5:37 AM
Not off the top of my head .. I am not that familiar with using .NET .. you may have to see if they have a config setting to account for this.

Scott.