jquery - how can i do not send optional params from ajax to c# function? -
i have following function on webservice 3 optional params: [webmethod] [scriptmethod(responseformat = responseformat.json)] public string obtenirpoble(string cp = "", int codi = 0, string nom = "") { list<clspoble> llista = _r.getlistpobles(cp, codi, nom); javascriptserializer jss = new javascriptserializer(); string resultat_json = jss.serialize(llista); return resultat_json; } the problem not make optional params because make on webservice. problem when i'm sending ajax call using json 1 param because trigger error before run webservice code //object send var dataobject = {}; dataobject[config.busqueda] = $(elemid).val(); var json = json.stringify(dataobject); $(elemid).autocomplete({ source: function (request, response) { $.ajax({ url: config.webservice, ...