1. UniSession.AddJS('$.ajax({' + 'url: "' + UniSession.CallbackUrl('$.ajax', self, []) + '",' + 'type: "POST",' + 'data: {username:"g", abc:123},' + 'dataType: "text",' + 'success: function(data){' + ' alert("OK!"+data);' + ' }' + '});'); procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string;Params: TStrings); begin if EventName = '$.ajax' then begin UniEdit1.Text := 'AAAAAAA'; //Execution is not successful(Show no change)。 showmessage(UniEdit1.Text);(Display results correctly) This is why? UniSession.AResponse.ContentText := '{"success":true,"manager":[{"name":"xxx","userId":"222"},{"name":"yyy","userId":"333"}]}'; end; end;
2. unisession.AddJS('ajaxRequest(MainForm.window,"ajaxRequest",[]);'); procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string;Params: TStrings); begin if EventName = 'ajaxRequest' then begin UniEdit1.Text := 'AAAAAA'; //Execution is successful(Show change) UniSession.Response := 'Ext.Msg.alert("","ok!");'; end; end;