Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModules"$.ServicesFramework is not a function" error only on mobile."$.ServicesFramework is not a function" error only on mobile.
Previous
 
Next
New Post
6/11/2015 1:46 PM
 

Thanks for any help or hints in advance!

I have developed a module to show local yard sales, both on a google map as well as in list form. Everything works fine on a desktop client but fails on a mobile client.

Been tearing my hair out for days on this one issue. When a user tries to enter a new yard sale (or edit or delete an existing one), it fails (but only when the client is on a mobile device). So it's failing on any call to a webservice and the only error I have been to get from it is "$.ServicesFramework is not a function".  So it appears the ServicesFramework is not getting defined, but only when the module is viewed on a mobile device.

Here is a snippet of code where the error occurs:

var sf = $.ServicesFramework(<%:ModuleContext.ModuleId%>); /*this is where it errors*/
 $.ajax({
         url: '/DesktopModules/KEG_YardSales/API/ModuleYardSale/AddYardSale',
         type: "POST",
         contentType: "application/json",
         beforeSend: sf.setModuleHeaders,
         data: JSON.stringify(YSToAdd),
         success: function(data) {
         loadYardSales("all");
       }
   });

I'm missing something but I have no idea where to start. What's confusing it that it works great on the desktop client using the same module (just on a different page).

TIA

Ken

 

 
New Post
6/15/2015 1:42 PM
 
make sure it's wrapped in a document.ready call, sometimes the servicesframework script is not loaded and that can cause an exception

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
6/15/2015 2:18 PM
 

Thanks for the reply Cathal.

I tried that and it didn't seem to change anything. (along with a hundred other things) I'm almost to the point of just rewriting the whole thing and doing away with the web services and ajax/json but would like to keep it this way if possible.

The whole page is pretty much one big javascript function. The aspx page only has a couple html css classes that get populated from the ajax and json calls in the js. In fact, the button that executes the script shown above (via onclick) doesn't even exist until the javascript has populated the page. Is there a way to "pre" populate the ServicesFramework to insure it's available when the other functions are called?

I'm still confused as to why it works perfectly from a desktop browser but fails on mobile. I've tried several phones and several browsers.

If you have the time to take a quick look at the code I'd really appreciate it. As I said, I did try wrapping the whole code block in a document ready function but it didn't seem to help. If you view the page source, the code is all right there in js with nothing in the code behind page. The webservices are called via ajax and json and are ran against DAL2 on the server side.

here's a link: http://lcvalley.dailyfly.com/Shop-Trade-Save/Yard-Sales

You'll notice from the code that you will need to register to see the "Add New Yardsale" button as well as edit buttons on any previously entered Yard Sales. Feel free to register if you feel like going that far.

Keep in mind this is all fast protoyped, I wanted to make sure it all worked before going back in and cleaning everything up. ;) (css is a mess, calls need to be cleaned up a little, etc.)

Thanks again for your input.

Kind regards,

Ken

 
New Post
6/15/2015 2:34 PM
 

Hi again Cathal,

Your response got me thinking...

Is there a way to "force" the loading of the ServicesFramework? Perhaps create a dummy webservice that returns nothing and place it in an ajax call in the javascript before the main function (which populates the page) gets called?

I'm fairly new to web programming and am still trying to get my head around the order and how items get loaded. I'm much more comfortable with desktop application programming . :)

Ken

 
New Post
6/17/2015 1:14 PM
 

I finally figured out what is happening but am at a loss as to how to fix it.

For some reason the dnn.servicesframework.js and dnn.js files are not being loaded on the "mobile" page as they are on the regular website page. I put mobile in quotes because it's really just another page with a different skin in order to strip the menus, etc. This is the reason for the original error ($.ServicesFramework is not a function).

I thought this might have something to do with the skin but couldn't find anything that I recognize as being an issue. But I really don't have a handle on how the pages are built in the background yet so I may be missing it. I do know that the files aren't being included in the skins, so there must be a script manager or something adding the scripts to the page dynamically.

I'm going through the skin files and comparing right now to see if something is getting called in one that isn't in the other, but I'm pushing the limits of my current understanding of DNN and how it works so I'm not too hopeful I'll find it.

If someone could just give me a hint as to what to look for I'd really appreciate it. 

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModules"$.ServicesFramework is not a function" error only on mobile."$.ServicesFramework is not a function" error only on mobile.


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out