Loading ...
Sorry, an error occurred while loading the content.

Re: Combining a Button with Connection Manager -- Nothing but Dead Air...

Expand Messages
  • Del
    Thanks for the reply Eric. I discovered the problem: var sUrl = voteStory.php?storyid= + storyid; for some reason passing vars to the ss script caused the
    Message 1 of 3 , Dec 30, 2007
    • 0 Attachment
      Thanks for the reply Eric.


      I discovered the problem:

      var sUrl = "voteStory.php?storyid=" + storyid;

      for some reason passing vars to the ss script caused the problem.
      Changing it to:

      var sUrl = "voteStory.php"

      solve the problem and it works fine. Strange really. Very strange.


      --- In ydn-javascript@yahoogroups.com, Eric Miraglia <miraglia@...> wrote:
      >
      > Del,
      >
      > I'd need to see a live URL where your example is failing.
      >
      > When I strip out the things that are context-specific and point the
      > XHR call at a file I know is present, I see the code execute all the
      > way through to the end:
      >
      > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
      > ">
      > <html xmlns="http://www.w3.org/1999/xhtml">
      > <head>
      > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      > <title>Button/XHR Test</title>
      >
      > <!-- Core + Skin CSS -->
      > <link rel="stylesheet" type="text/css"
      href="http://yui.yahooapis.com/2.4.1/build/button/assets/skins/sam/button.css

      > ">
      > <!-- OPTIONAL: Menu Stylesheet (required for creating buttons of type
      > "menu" and "split") -->
      > <link rel="stylesheet" type="text/css"
      href="http://yui.yahooapis.com/2.4.1/build/menu/assets/skins/sam/menu.css
      > ">
      >
      > <!-- Dependencies -->
      > <script type="text/javascript"
      src="http://yui.yahooapis.com/2.4.1/build/yahoo-dom-event/yahoo-dom-event.js

      > "></script>
      > <script type="text/javascript"
      src="http://yui.yahooapis.com/2.4.1/build/connection/connection-min.js
      > "></script>
      > <script type="text/javascript"
      src="http://yui.yahooapis.com/2.4.1/build/element/element-beta-min.js
      > "></script>
      >
      > <!-- OPTIONAL: Menu and Container Core (required for creating buttons
      > of type "menu" and "split") -->
      > <script type="text/javascript"
      src="http://yui.yahooapis.com/2.4.1/build/container/container_core-min.js
      > "></script>
      > <script type="text/javascript"
      src="http://yui.yahooapis.com/2.4.1/build/menu/menu-min.js
      > "></script>
      >
      > <!-- Source file -->
      > <script type="text/javascript"
      src="http://yui.yahooapis.com/2.4.1/build/button/button-min.js
      > "></script>
      > </head>
      >
      > <body class="yui-skin-sam">
      > <div id="pushbuttonsfromjavascript">
      >
      > </div>
      > <script type="text/javascript">
      > YAHOO.example.init = function () {
      > // "click" event handler for each Button instance
      > function onButtonClick(p_oEvent) {
      > alert('pushed!'); // this alert executes
      > var successHandler = function(o){
      > alert("success");
      > }
      > var failureHandler = function(o){
      > alert("failure");
      > }
      >
      > var request = YAHOO.util.Connect.asyncRequest('GET', "test.php",
      > {success:successHandler, failure:failureHandler });
      >
      > //This does execute:
      > alert('onButtonClick function is complete');
      > }
      >
      > // Create Buttons without using existing markup
      > var oPushButton7 = new YAHOO.widget.Button({
      > label:"Add",
      > id:"pushbutton7",
      > container:"pushbuttonsfromjavascript",
      > disabled: false
      > });
      > oPushButton7.on("click", onButtonClick);
      >
      > }();
      > </script>
      > </body>
      > </html>
      >
      > The issue may be a missing dependency. Is Connection Manager loaded
      > on the page?
      >
      > Regards,
      > Eric
      >
      >
      > ______________________________________________
      > Eric Miraglia
      > Yahoo! User Interface Library
      >
      >
      >
      > On Dec 27, 2007, at 11:04 PM, Del wrote:
      >
      > > I created a button based on the examples provided on the YUI site, I
      > > then linked connection manager into the onButtonClick() function ...
      > > when the button is clicked nothing happens (the alert shows up.. but
      > > nothing executes after that.. no errors.. nothing).
      > >
      > > Not sure what to do, Firebug isn't helping either....
      > >
      > > <script type="text/javascript">
      > > YAHOO.example.init = function () {
      > > // "click" event handler for each Button instance
      > > function onButtonClick(p_oEvent) {
      > > alert('pushed!'); // this alert executes
      > > var sUrl = "voteStory.php?storyid=" + storyid;
      > > var successHandler = function(o){
      > > var root = o.responseXML.documentElement;
      > > document.getElementById('playerKarmaStatus').innerHTML =
      > > root.getElementsByTagName('voteValue')[0].firstChild.nodeValue;
      > > document.getElementById('playerNextLevelStatus').innerHTML =
      > > root.getElementsByTagName('storyID')[0].firstChild.nodeValue;
      > > document.getElementById('playerLevelStatus').innerHTML =
      > > root.getElementsByTagName('oldVoteValue')[0].firstChild.nodeValue;
      > > }
      > > var failureHandler = function(o){
      > > alert("failure");
      > > }
      > >
      > > var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, {
      > > success:successHandler, failure:failureHandler });
      > >
      > > alert('this function is dead'); // this alert does not execute at all
      > > }
      > >
      > > // Create Buttons without using existing markup
      > > var oPushButton7 = new YAHOO.widget.Button({
      > > label:"Add",
      > > id:"pushbutton7",
      > > container:"pushbuttonsfromjavascript",
      > > disabled: false
      > > });
      > > oPushButton7.on("click", onButtonClick);
      > >
      > > } ();
      > > </script>
      > >
      > >
      > >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.