Skip navigation
Currently Being Moderated

jquery help

Feb 27, 2012 8:10 PM

How would I make a call to a jquery function so that when a user submits a form, a image slowly fades in.  I am new to jquery, and all I can find is on button clicks.  would there be a way to call on the function, from php preferebly?

 
Replies
  • Currently Being Moderated
    Feb 28, 2012 5:35 AM   in reply to future-architect

    future-architect wrote:

     

    How would I make a call to a jquery function so that when a user submits a form, a image slowly fades in.  I am new to jquery, and all I can find is on button clicks.  would there be a way to call on the function, from php preferebly?

    To answer the last part of your question first, jQuery is a JavaScript library. JavaScript is client side code that is interpreted by the browser. PHP is server side code which is interpreted by the server. With a few exceptions, because of the different platforms, the two cannot be interchanged. The exceptions include code that is executed by the server first like var myVar = <?php echo $myVar; ?>; and similar. Note that the document must have the PHP extension.

     

    For any action to occur, there must be an event that  triggers the action. You have already named the onclick event, but there are other events like onBlur, onChange, onLoad, onSubmit etc. that can be used as a trigger. These events can only be client side events.

     

    Gramps.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 28, 2012 7:51 AM   in reply to future-architect

    Yes, that can be done.

     

    <?php

         // if form submitted execute code to process the data

    ?>

         // javascript to hide form and fade in image

    <?php

         // end if

    ?>

    Gramps

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 29, 2012 11:34 AM   in reply to future-architect

    Put your success page url into the PHP script. 

     

    Then use jQuery on the success page.

    http://alt-web.com/DEMOS/fading-logo-redirect.shtml

     

     

    Nancy O.

    Alt-Web Design & Publishing

    Web | Graphics | Print | Media  Specialists 

    http://alt-web.com/

    http://twitter.com/altweb

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 29, 2012 12:12 PM   in reply to future-architect

    Sure.  Simply remove the re-direct part.

     

     

    Nancy O.

    Alt-Web Design & Publishing

    Web | Graphics | Print | Media  Specialists 

    http://alt-web.com/

    http://twitter.com/altweb

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points