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