postData not passing any parameters!

前端 未结 1 685
余生分开走
余生分开走 2020-11-27 08:07

I\'m not able to see any parameters value passing to server in firebug. Here is the code.


//BuyBackGridInit() start

function BuyBackGridInit(tabID){


             


        
相关标签:
1条回答
  • 2020-11-27 08:44

    You current implementation of serializeGridData just remove all functions parameters from the postData. So you should either extend data parameter inside of serializeGridData instead of the usage of postData. Another way is to modify serializeGridData to the following:

    serializeGridData: function (data){
        var propertyName, propertyValue, dataToSend = {};
        for (propertyName in data) {
            if (data.hasOwnProperty(propertyName)) {
                propertyValue = data[propertyName];
                if ($.isFunction(propertyValue)) {
                    dataToSend[propertyName] = propertyValue();
                } else {
                    dataToSend[propertyName] = propertyValue
                }
            }
       }
       return JSON.stringify(dataToSend);
    }
    

    In the code above we enumerate all properties and call all functions explicitly. Moreover I prefer to use JSON.stringify function from json2.js. The function will be native implemented in many web browsers.

    See the demo here.

    0 讨论(0)
提交回复
热议问题