Page 1 of 1

Error Message adding Jquery 2.1.0 library to server code

Posted: Wed Mar 05, 2014 12:13 pm
by Bad Addy

I am trying to add the library of the latest jquery so it can be a dependancy in a server code script. But I all I get is errors, going back too 1.10.2

Really annoying me, as I am calling a ajax within the logic, and it dont understand $. for some reason.

Here is my error

3/5/2014 12:10:04 PM: Script query 2.1.0: TypeError: Cannot read property 'defaultView' of undefined ( @ 2 : 68 ) - :!1},k=db.setDocument=function(a){var b,e=a?a.ownerDocument||a:t,g=e.defaultVi

Please advise asap.


Error Message adding Jquery 2.1.0 library to server code

Posted: Wed Mar 05, 2014 2:25 pm
by Nikita

Hello!

How do you add jquery to servercode? And why do you need it there?


Error Message adding Jquery 2.1.0 library to server code

Posted: Wed Mar 05, 2014 2:27 pm
by Bad Addy

Yeah, its in server code, I did some more to it and changed it to this:

precode

var params = {}; //Define parameters object
params.criteria = {
'group_type': stype,
'group_name': sname
}
result = {};
result.query = Collection.query(db_id, 'groups', params, st); //Make the query and save it to the result object
console.log(result);
/code/pre

But I cannot do $.each on the results. I need to go through each one for a push script. Why can I not use jquery ?


Error Message adding Jquery 2.1.0 library to server code

Posted: Wed Mar 05, 2014 3:36 pm
by Nikita

Hi,

Jquery isn't connected to the servercode by default. You can try this: http://stackoverflow.com/questions/93...


Error Message adding Jquery 2.1.0 library to server code

Posted: Wed Mar 05, 2014 3:49 pm
by Bad Addy

That worked, but I have gone with this, just incase:

precode
for(var i = 0; i < result&#46;query&#46;length; i++) {
&#47;&#47;console&#46;log(result&#46;query&#46;user_id);
PN&#46;send(
"7d*1717-*****51c",
{ "message": "Notification sample", "badge": 1},
{"user_id": result&#46;query&#46;user_id}
);
};
/code/pre

With the sever code, and when its called, in the example above, where once its filtered the data, it sends a message. how can i get it to return the result of the Push, rather than the data in the first database request ?


Error Message adding Jquery 2.1.0 library to server code

Posted: Wed Mar 05, 2014 9:02 pm
by Maryna Brodina

Hello! Could you clarify what do you mean on "return the result of the Push"? Do you mean Push status? PN.send returns nothing. To get status you can send push through XMLHttpRequest http://docs.appery.io/documentation/b... using Push notification API http://docs.appery.io/documentation/b...