خرید بک لینک

Vote count: 0

So i have created a function to post data to a php page:

function updateData(x,y){
     $.ajax({   
        type: 'POST',   
        url: 'myupdate.php',   
        data: {x:y},
           success: function(data){
           $("#resultdiv").html(data);
          }
       });
}

And I call the function like this:

$(".myclass").click(function(){
        var newname = $("#myname").val();    //value of input type="text".
        updateData('name', newname);        // also tried updateData(name, newname)
});

So if i input the value as Rocky and initiate the function, problem is that the value sent to the php page myupdate.php is x=Rocky. I want it to be name=Rocky. How can i solve this.

Many thanks.

asked 14 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 13 مرداد 1395 ساعت: 19:45

صفحه بندی