Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Database/DataSnap/Server    [ Add a report in this area ]  
Report #:  90841   Status: Closed
json-min.js causes problems with jQuery plugins
Project:  Delphi Build #:  15.0.3953.3517
Version:    15.1 Submitted By:   Marco Cantu Wintech Italia
Report Type:  Basic functionality failure Date Reported:  1/12/2011 2:20:52 PM
Severity:    Serious / Highly visible problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   281618
Resolution: Fixed (Resolution Comments) Resolved in Build: : 16.0.4197.40796
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
The bug I'm experiencing is between the "json-min.js" file added by the Delphi wizard and some of the jQuery components (but not the core jQuery) itself.

json-min.js is a rather out-of-standard JS library, causing problems with other JS libraries. Namely I had serious issues with jQuery and replaced it with json2.js from
http://www.JSON.org/json2.js

I also fixed the other JS libraries in DataSnap REST accordingly.

Can attach a demo I already emailed to
Steve Axtell <Steve.Axtell@embarcadero.com>
Mathew Delong <Mathew.Delong@embarcadero.com>
who asked me to open the QC case...

Can also send the modified code with the fixes, if useful, but I'll blog about this as well.

Steps to Reproduce:
Create a DataSnap REST Application wizard generated program with these changes:

- added jquery plus a couple of addins to the JS folder
- references those in the ReverseString.html file
- added one start up line that calls the validation tool, and causes
the error (you see the error only in a JavaScript console in the
browser!)
- the error goes away if you remove the json2-min.js

Workarounds
replaced the library with json2.js from http://www.JSON.org/json2.js

changing the calls inside ServerFunctionExecutor.js (line 251)

     contentParam = JSON.stringify(contentParam);  // new
     //contentParam = contentParam.toJSONString(); // original

And similarly at line 148 and 174 of ServerFunctionInvoker.
With these fixes everything seems to work and I had no problems, but I
run only specific tests.

I also found one of the opposite calls (string to JSOn object)

More info on my blog (http://blog.marcocantu.com) - January 2011.
Attachment
None
Comments

Tomohiro Takahashi at 1/12/2011 2:51:51 PM -
I think this issue also exists in RadPHP XE's DataSnap feature.
Please take a look at QC#89238 ?

Server Response from: ETNACODE01