jquery和php计算点击次数,并将结果发布在另一个页面中

<p>which color do you prefer?</p>
<button type="button" id="redButton" value="Red"/>
<button type="button" id="greenButton" value="Green"/>
<button type="button" id="blueButton" value="Blue"/>


<p>Red => <span> 0 </span></p>
<p>Green => <span> 0 </span></p>
<p>Blue => <span> 0 </span></p>

I'm trying to make a form with a question like: Which color do you prefer? (The buttons in a question.html and the result in result.html)

And buttons which can be clicked to answer (red, green, blue).

On another page I want to take this data and want to check how many times each button was clicked and post it (in a way - red - 3 clicks and so on).

I want to do it with jQuery and PHP - and honestly I don't know much about php. Can any one please help me?

</div>

As you can see from the votes, this type of question doesn't really fit well here at SO. We generally expect that you have code showing what you have tried so far and are asking for help with a specific issue you are facing.

That said, if I were you, I would use parse.com's services which will let you do this with just javascript.

Here is a post that will explain what you'd need to do to get setup with parse.

Here is a working jsFiddle showing how to save the votes

Code from that demo:

<input type="button" value="Red" class="vote"/>
<input type="button" value="Green" class="vote"/>
<input type="button" value="Blue" class="vote"/><br><br>
<div id="link"></div>


Parse.initialize("Application ID", "JavaScript key");

$('.vote').click(function(){

        // create the `Parse` object
        var ColorVote = Parse.Object.extend("ColorVote");
        var _colorVote = new ColorVote();

        // set the object's value to our button value
        _colorVote.set("color", $(this).val());

        // save the object
        _colorVote.save(null, {
          success: function(_colorVote) {
            // if the save succeeded, give link to view results
               $('#link').html('Vote saved! Please <a href="http://jsfiddle.net/DelightedDoD/ekgj2y5L/2/" target="_blank">click here</a> here to see the results of the vote so far.')
          },
          error: function(_colorVote, error) {
            // save failed, do error handeling here
            console.log('Failed to create new object, with error code: ' + error.message);
          }
        });

});

Here is a working jsFiddle showing how to display the saved votes

Code from that demo:

<div id="results"></div>


Parse.initialize("Application ID", "JavaScript key");

// create a query to search for  our `ColorVote` items
var ColorVote = Parse.Object.extend("ColorVote");
var query = new Parse.Query(ColorVote);
query.limit(1000);
query.find({
    success: function (results) {
        var red =0, green =0, blue =0;
        $.each(results, function(i,e){
            if(e.get('color')=='Blue') blue++;
            else if(e.get('color')=='Green') green++;
            else if(e.get('color')=='Red') red++;
        });
        $('#results').html('Blue - '+blue+'<br>'+'Green - '+green+'<br>'+'Red - '+red+'<br>');
    },
    error: function (error) {
        console.log("Error: " + error.code + " " + error.message);
    }
});