Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Rinat_Y_
Beginner
69 Views

Object is not a function (evaluating 'h.promise(C)') - jquery.min.js version suspected (?)

Hello,

I have jquery POST that works just fine from Safari and has been failing on jquery.min.js with the following error:

Object is not a function (evaluating 'h.promise(C)')

Based on the differences and here is query.min.js that comes with XDK project:

/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery-1.10.2.min.map
*/

While the one I'm using with Safari browser form: 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

Just for the heck of it, I took the following 2 lines from Safari's index.html and added to XDK's index.html file:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src='google-sheet.js'></script>

And it broke "EMULATE" so it would not even render UI for the application...

Since application is working just fine on MacBook with Safari it looks like there is some sort of underlying problem with libraries on XDK.

Does anyone know what the root cause of "Object is not a function (evaluating 'h.promise(C)') " error can be and how to fix it?

Thanks,

Rinat

PS: BTW, each time I press enter in this textbox (using Safari browser) it add the line and then goes to the "Home" (equivalent of Ctrl+Home on Microsoft Word on Windows). It is really, really annoying to say the least. If there is a moderator for this, please feel free to file a bug for this.

 

 

 

 

Tags (2)
0 Kudos
8 Replies
PaulF_IntelCorp
Employee
69 Views

Replace the jQuery lib file in the project with jQuery 2, don't reference that CDN. See this FAQ > https://software.intel.com/en-us/xdk/faqs/app-designer#ajax-jquery-one-fail

0 Kudos
Rinat_Y_
Beginner
69 Views

Thank for your comment Paul.

I was going to update the thread with further results, but it got blocked by "Your submission has triggered the spam filter and will not be accepted. If you feel this is in error, please report that you are blocked."..., not sure why my update was blocked at the first place.

Anyway, here is update:

After further digging found that DXK's index.html file has "specific" areas to place *.js files.

Did that jquery.min.js so it would point to 2.1.4:

        <!--            
        You may substitute jQuery for the App Framework selector library.
        See http://app-framework-software.intel.com/documentation.php#afui/afui_jquery
        <script type="application/javascript" src="lib/jquery.min.js"></script> - OLD entry
        -->
        <script type="application/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

Tried to run it again and got different error this time:

Object is not a function (evaluating 'o.promise(v)') console-via-logger.js:174
9137
 

I will take a look at the link you provided (https://software.intel.com/en-us/xdk/faqs/app-designer#ajax-jquery-one-fail) to see if I missed anything.

Also, could you tell what is the reason to stay to far behind on the library?

Thanks,

Rinat

0 Kudos
PaulF_IntelCorp
Employee
69 Views

Anyway, here is update:

Last night  found that DXK's index.html file has "specific" areas to place *.js files:

        <!--            
        You may substitute jQuery for the App Framework selector library.
        See http://app-framework-software.intel.com/documentation.php#afui/afui_jquery
        <script type="application/javascript" src="lib/jquery.min.js"></script> - OLD entry
        -->
        <script type="application/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

Tried to run it again and got different error this time:

Object is not a function (evaluating 'o.promise(v)') console-via-logger.js:174
9137
 
Then today tried with full jquery 2.2.3 and got slightly better error message there:
 
 

Here is what POST does:

request = $.ajax({

                url: "https://script.google.com/MY_FILE_ACCESS/exec",

                type: "post",

                data: serializedData

            });

And it works w/o issues from Safari to GSS (google spreadsheet).

Thank you for the response and if you happen to know what else to look into please let me know.

Rinat

Did you include a weinre script in your app? It looks like that is the case. This could be causing problems; if you included reference to a weinre script (eg., script reference copied from the Test tab) remove it from your index.html file.

Also, download the version of the jQuery lib you want to use and make it part of your app (like the original, where it is a file located in your app directories and relative referenced within your index.html file). Do not reference it over the network via a CDN, that will cause problems for your real app.

0 Kudos
Rinat_Y_
Beginner
69 Views

Hello Paul,

Removing weinre script did not make any difference, it looks like as I was getting the same type of errors while using over the network references.

Then tried to use local copies and misplaced jquery file (rather then putting in the current project, added to the wrong one)...
This broke "EMULATE" tab completely..., pocked around and found where problem is, placed file in the right place and still "EMULATE" is broken beyond any repairs...

"DESIGN" @ "DEVELOP" shows UI layout just fine, but "EMULATE" is dead in the water.

Sounds like some low level integration issue with XDK, or something like that.

Any suggestions how to fix it will be appreciated greatly.

Thank you,

Rinat

0 Kudos
Chris_P_Intel
Employee
69 Views

If you are not using any Cordova plugins, you can go to the Code View in the Develop tab and use the "Live Layout Preview" to open your page in a browser, rather than the Emulator.

But, I suspect, you'll have the same problem there. Something is likely wrong in your HTML or JS

0 Kudos
Rinat_Y_
Beginner
69 Views

Thank you for the comment Chris P.

I'm not actually looking for the workaround, but rather solution to get working project back into "production" where XDK's "EMULATE" feature is back into working state. 

While waiting for the "right" solution, I have tried "migration" to the brand new project by copying html, js and css files, but that did not go well either.

At this point, I'm seriously considering to drop XDK all together and go with with simple migration to Cordova: https://auth0.com/blog/2015/12/08/converting-your-web-app-to-mobile/

~Rinat

0 Kudos
Rinat_Y_
Beginner
69 Views

OK, here is something that I caught while going basically line-by-line where syntax parser did not like seemingly right syntax of the <script> line.

Fixed that and although, now IDE seems to "like" proper syntax both "DESIGN" and "EMULATE" are remain broken.

Was going to upload screenshots to show the difference, but this forum tools are SO cumbersome (and make me think of a stone age), so I basically give up on time wasting to figure out how can I just upload 2 screenshots files.

~Rinat

PS: here are screenshots (and I hope this thread does not get spammed): https://drive.google.com/folderview?id=0ByaLY2h9IAqSdllzQ1F1YjJHQXc&usp=sharing

0 Kudos
PaulF_IntelCorp
Employee
69 Views

In the second image you're missing a " character on line 71, surrounding the lib/jquery... reference.

0 Kudos