Support Forums

Questions about surveying? How does this thing work? We're here to help!

The Forums are now closed, because much of the older info is out of date.

Check out our Knowledge Base, ask a support question: Support.SurveyGizmo.com or ask a sales question with our Sales Contact Form.

Current User: Guest

jQuery Interop

Topic Locked
UserPost

7:02
January 30, 2009


richardhauer

New Member

posts 2

Our site uses jQuery and we are trying to embed an SG survey using the AJAX model. We are experiencing some problems because the script that is returned from http://app.sgizmo.com/s/survey…..pid=respid redefines the “$” function in the line:
document.write(“function $(id){return(document.getElementById(id));}\n”);

jQuery defines this function as:
var $ = function( selector, context ) { return new jQuery.fn.init( selector, context ); }

Any ideas how to get around this? I think many sites use jQuery these days (it is becoming part of the ASP.NET tools shortly) so its probably not a good idea to redefine the “$” function like this.

6:46
January 30, 2009


Derek Scruggs

Admin

posts 36

Hi Richard,

You will need to use jQuery’s noConflict function on any page that includes the survey. http://docs.jquery.com/Core/jQ…..noConflict

Sorry for the inconvenience. Thanks!

-Derek

Did this answer help? Let us know!
Want to be a SurveyGizmo ninja? Learn here!

12:42
April 24, 2009


vijayanand

Guest

vijayanand.gawle@gmail.com

gvijayanandg@yahoo.com


can any one proved me any sample code for how to use surverygizmo in asp.net application.

or any refer sites how to use it.is their any webservice releted to it.

3:37
April 24, 2009


jonathan

Admin

posts 1129

Hello, Vijayanand!

How are you trying to integrate SurveyGizmo into your ASP application? If you just need to embed the survey on your page, you cane asily do this using the Javascript Embed code we provide in the “Publish” tab; but if that isn't what you're trying to do, please let me know!

Thanks!

Jonathan Turk, SurveyGizmo Account Manager
Did this answer help? Let us know!
Want to be a SurveyGizmo Expert? Learn here!

2:04
June 22, 2009


WB

Member

posts 5

Derek Scruggs said:

Hi Richard,

You will need to use jQuery’s noConflict function on any page that includes the survey. http://docs.jquery.com/Core/jQ…..noConflict

Sorry for the inconvenience. Thanks!

-Derek


Inconvenience? I think that changing several .js files that are used outside of the SG API rather than your coders amending the effect of 3 lines or so in yours to make the code work with IE, Chrome etc, is rather more than just an inconvenience. Can you assure me that this is something you are looking at  as a matter of utmost priority, since currently your code is non-compliant?

4:41
June 22, 2009


richardhauer

New Member

posts 2

For what it's worth, using jQuery's noConflict function was not going to be an option for us – in fact we'd need to change dozens of templates in our CMS, so frankly I'm not particularly impressed with the response “tough luck”.  But I'll bide my time because soon enough the jQuery “$” function will be prolific on the internet thanks to Visual Studio 2010 due any minute and SurveyGizmo will have to fall into line and change their use of this function name.

In the mean time for anyone looking to work around this problem, this is what we did:

  • Immediately before the SG injection script add the following:

<script> var JQ$ = $; </script>

  • Add SG injection script as normal
  • Immediately after the SG injection script add the following:

<script> $ = JQ$; </script>

Basically we keep a copy of the jQuery “$” function in a variable and restore it to its original value when the SG scripts have finished.  I do this rather than using “var $ = function( selector, context ) { return new jQuery.fn.init( selector, context ); }” becuase jQuery may change their initialisation parameters at a later date and I prefer to not have to update my code.

HTH.

9:49
June 22, 2009


Derek Scruggs

Admin

posts 36

Hi All,

I just reviewed this with our dev team and they will start working on this immediately. They tell me to expect it to be available by the end of next week. The biggest challenge is backward compatibility, hence the extra dev time for testing.


Thanks!

-Derek

Did this answer help? Let us know!
Want to be a SurveyGizmo ninja? Learn here!

9:24
June 23, 2009


WB

Member

posts 5

Post edited 4:24 – June 23, 2009 by WB
Post edited 4:25 – June 23, 2009 by WB


richardhauer: worked perfectly! thank you :-)

5:27
September 8, 2009


Chris

Guest

Derek Scruggs said:

Hi All,

I just reviewed this with our dev team and they will start working on this immediately. They tell me to expect it to be available by the end of next week. The biggest challenge is backward compatibility, hence the extra dev time for testing.


Thanks!

-Derek


 Any word on this fix yet?

6:57
September 8, 2009


jonathan

Admin

posts 1129

Hey, Chris!

We've made some changes and the embed should work a la carte, but with our recent data migration and the upgrades we've made to email invites, we just haven't had a chance to finish fully testing yet.

Jonathan Turk, SurveyGizmo Account Manager
Did this answer help? Let us know!
Want to be a SurveyGizmo Expert? Learn here!



The Forums are now closed, because much of the older info is out of date.

Check out our Knowledge Base, ask a support question: Support.SurveyGizmo.com or ask a sales question with our Sales Contact Form.