Forums / Developer / Ezjscore problem

Ezjscore problem

Author Message

Håvard Bergersen

Monday 08 November 2010 4:02:01 am

I have created some ezjscore servercall functions.

When running the call i via the addressbar (http://www.example.com/ezjscore/call/something::somethingelse::parameter) get the expected values.

When running it via a js file, is doesn't work.

function functionName(id,cat){
    jQuery(function( $ )
    {
    // Any action here will work. E.g an alert, or console.log(); or something
        $.ez( 'someThing::someThingElse::'+id+'::'+cat, {arg1: ' '}, function( data )
        {
        // Any action here will NOT work!

So,, all the information extraction is successfully done, and the right function is trigged, but within the $.ez() function nothing happens...

Anybody knows what the problem might be?

Nicolas Pastorino

Monday 08 November 2010 4:14:17 am

Hi Håvard ,

Have you made sure the generated JS actually is correct ? ie : if generated from a template, was it encapsulated in {literal} {/literal} tags ?

Cheers,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Håvard Bergersen

Monday 08 November 2010 4:19:07 am

The funtion is in it's own .js file, and the calling of the function is done i the template. The calling is correct) :)

Would have gotten javascript errors if it wasn't?

Might be worth mentioning that the servercall returns the right values, when survailing it with firebug:
Response: 200 OK , and all the content i asked for is there...

Nicolas Pastorino

Monday 08 November 2010 4:28:51 am

Even when tracking the server's answer through Firebug, you see the correct content ? Json i suppose ?

If nothing in the callback function is run, it might mean that JS execution is stopping before the calback function is called in $.ez(..). Is the returned content (from the ajax call to the server) likely to contain unproper sequences of character ?

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Håvard Bergersen

Monday 08 November 2010 4:38:06 am

"

Even when tracking the server's answer through Firebug, you see the correct content ? Json i suppose ?

"

Yes (!) That's the weird part hehe..:)

As far as I can tell, there is nothing unproper about the chars.

I suspect there might be a typo somewhere in the 400 line long .js file, that f*** things up? Is that a possibility? Allthoug i thik that would be weird, becase if that is the matter, than nothing should have worked? Or?

Gaetano Giunta

Monday 08 November 2010 6:33:20 am

In case it might help you: the svn version of the ggwebservices extension just had ezjscore support committed to it (lat night!).

You can use the extension to send ezjscore calls to the server itself, and have dumps of request and response printed to screen.

The response is also parsed as json, so if there is some 'bad' character ruining your responses, you should be able to spot it.

(ps: sorry for this self-promotion ;-) )

Principal Consultant International Business
Member of the Community Project Board

Gaetano Giunta

Monday 08 November 2010 6:35:03 am

ps: you can also test using Y.io.ez instad of jquery, to see if the fault lies in the part of the js code that sits between the actual response and your own js response handler...

Principal Consultant International Business
Member of the Community Project Board

Håvard Bergersen

Tuesday 09 November 2010 3:48:06 am

Hehe, thanks for the tip.. Will try it out :)

Håvard Bergersen

Tuesday 09 November 2010 4:30:20 am

It seems the problem is between the .js and the .php files included. Both works fine seperatly, but when combining them they fail...?

Nicolas Pastorino

Tuesday 09 November 2010 5:41:17 am

Could you push this online somewhere, so that we can put hands on. Forum-debugging is not suitable to these "extreme weirdness" cases :)

Cheers !

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Håvard Bergersen

Tuesday 09 November 2010 7:17:39 am

Hmmmm... Maybe i could but,,

There is a jscore function, calling a custom fetch function, that fetches from a restricted windows 2005 server.. (my environment is linux..)

Sooo,, need less to say, it's not easy to recreate this.. :)

I suspect there is a error of some sort in the [...]functioncollection.php, OR is there som kind of problem connected to running ezFunctionHandler::execute on custom fetches via ezjscore? I don't know.. :)

Gaetano Giunta

Tuesday 09 November 2010 8:04:55 am

As far as my experience goes (in coding the ezwebservicesapi extension), there is no problem in running a fetch from within an ezjscore function: http://svn.projects.ez.no/ezwebservicesapi/trunk/extension/ezwebservicesapi/classes/ezwebservicesapiexecutor.php (look at static method ezpublish_fetch

Principal Consultant International Business
Member of the Community Project Board

Nicolas Pastorino

Wednesday 10 November 2010 7:09:54 am

Any move on the topic ?

How about pasting the firebug output (of the XHR) plus de js code used in some snippet sharing place ?

Cheers,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Gaetano Giunta

Friday 12 November 2010 2:14:15 am

I'd go as far as suggest using Wireshark or the ff plugin livehttpheaders to debug this and get a reliable trace of the requests

Principal Consultant International Business
Member of the Community Project Board

eZ debug

Timing: Jan 17 2025 22:49:24
Script start
Timing: Jan 17 2025 22:49:24
Module start 'content'
Timing: Jan 17 2025 22:49:24
Module end 'content'
Timing: Jan 17 2025 22:49:24
Script end

Main resources:

Total runtime0.8055 sec
Peak memory usage4,096.0000 KB
Database Queries229

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0072 587.5938180.8516
Module start 'content' 0.00720.6928 768.4453720.0703
Module end 'content' 0.70000.1055 1,488.5156357.3203
Script end 0.8054  1,845.8359 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.4660210.0002
Check MTime0.00140.1743210.0001
Mysql Total
Database connection0.00090.106110.0009
Mysqli_queries0.702687.22202290.0031
Looping result0.00220.27862270.0000
Template Total0.777596.520.3887
Template load0.00210.255520.0010
Template processing0.775496.267920.3877
Template load and register function0.00020.024710.0002
states
state_id_array0.00080.097610.0008
state_identifier_array0.00080.100920.0004
Override
Cache load0.00200.2445680.0000
Sytem overhead
Fetch class attribute can translate value0.00200.245540.0005
Fetch class attribute name0.00100.1251170.0001
XML
Image XML parsing0.00310.382540.0008
class_abstraction
Instantiating content class attribute0.00000.0061280.0000
General
dbfile0.00440.5435390.0001
String conversion0.00000.001130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
14content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
14content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
17content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 50
 Number of unique templates used: 8

Time used to render debug report: 0.0001 secs