I’m not the first that find this problem, and I saw the solutions, my problem is a little bit different:
The main page index.php call _division.php in a div, inside _divison I have a form and when I post something I register it on the db and I refresh the gridview but I don’t call render or renderPartial, the problem was that after the first click of the ajaxSubmit or the ajaxLink it stop to work and in then next refresh it post 2 times, next 3 times… I resolved in that way:
on the link I take all the elements of the class prova, naturally I can take $(#form_name).children(), and I used serializedArray, after I used each and I created an array with name<-|->value, I didn’t use associative array because I cant pass it with the $.get function.
echo CHtml::link("butta", '#',array(
'onclick'=>'js:
var fields = $(".prova").serializeArray();
var toGive =[];
jQuery.each(fields, function(i, field){
if( field.name != undefined && field.name != "" && field.value != undefined)
toGive.push(field.name+"<-|->"+field.value);
});
$.get("index.php?r=corporation/addPerson",{"values":toGive},function(msg){
alert(msg);
});
'
)
);
after on the controller I created in PHP the associative array inside $values
for($i=0; $i<count($_GET['values']); $i++)
{
$temp=explode("<-|->",$_GET['values'][$i]);
$values[$temp[0]]=$temp[1];
}
better ideas?