Jquery

Discussion in 'jQuery' started by dean5000v, Nov 4, 2009.

  1. #1
    Hey just got a general question on the methodology behind something.

    lets say i add some small jquery code that changes the color and font weight of a p tag.

    <script>
      $(document).ready(function(){
     $('#test').hover(function() {
      $(this).click(function(){$("p").css({color:"#993300", fontWeight:"bold"}); 
    })
      });
     });
    Code (markup):
    how would i pass these values onto PHP so that a new page can be generated with the new css styles would i have to send it via GET variables? so that PHP can pick it up.

    any small little examples would be good.
     
    dean5000v, Nov 4, 2009 IP
  2. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #2
    you can also use cookies and on the document ready can read the cookie and pre-apply this - keep the end user layer clientside imo.
     
    dimitar christoff, Nov 4, 2009 IP
  3. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #3
    well, you can store these data in a hidden html variable and php can read that variable viat $_POST.
    that means, while changing the style of p tag, you also need to store the details in an html variable.
     
    mastermunj, Nov 4, 2009 IP
  4. robbin.joe

    robbin.joe Peon

    Messages:
    52
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    another way is to use AJAX, in jQuery like this, $.ajax('/phpurl/', {color: '#ccc'}, function(){});
    very easy.

    and the phpurl is a url to accept the request
     
    robbin.joe, Nov 10, 2009 IP