Guest Posted December 14, 2010 Posted December 14, 2010 Message from: "fbarley" I am using HTML Frame with great success in testing. Now I need to hook up some server side logic to the user inputs in the HTMLFrame. How do I set up a Ext.Ajax.request({url:"mydll/HandleEvent"... on the client and server side to handle HTMLFrame coordination? Or is there a better way? . Quote
Guest Posted December 14, 2010 Author Posted December 14, 2010 Message from: "Farshad Mohajeri" "fbarley" wrote in message news:m0SsKW5mLHA.2080@anaxagvs227... >I am using HTML Frame with great success in testing. Now I need to hook up >some server side logic to the user inputs in the HTMLFrame. > > How do I set up a Ext.Ajax.request({url:"mydll/HandleEvent"... on the > client and server side to handle HTMLFrame coordination? Or is there a > better way? Interaction between ClientSide JavaScript code and server handlers is not implemented yet. It is planned to be implemented in one of the 0.8x releases. That said, you can use JS code to call one of the "existing" AJAX handlers. . Quote
Guest Posted December 15, 2010 Author Posted December 15, 2010 Message from: "Junior/RO" Farshad Mohajeri escreveu: > That said, you can use JS code to call one of the "existing" AJAX handlers. Can you give us a example of this? -- Que é essa vida se, com tanto a fazer, não temos tempo para parar e ver? . Quote
Guest Posted December 15, 2010 Author Posted December 15, 2010 Message from: "Farshad Mohajeri" "Junior/RO" wrote in message = news:tz07aOJnLHA.2084@anaxagvs227... > Farshad Mohajeri escreveu: >=20 >> That said, you can use JS code to call one of the "existing" AJAX = handlers. >=20 > Can you give us a example of this? >=20 Consider you have a UniButton1 on form and it has a click event. In UniHTMLFrame BeforeScript property: function AjaxSuccess(response){ try{ eval(response.responseText); } catch(err){ AjaxError(err.message+""+response.responseText); } }; function buttonClick(Btn) { = Ext.Ajax.request({url:"/HandleEvent",params:"Ajax=3D1&Ajax=3D1&IsEvent=3D= 1&Obj=3D"+ = Btn.nm+"&Evt=3Dclick&This=3D"+Btn.nm+_gv_(O0),success:AjaxSuccess,failure= :{},obj:Btn}); }; =20 In Form OnShow event: procedure TMainForm.UniFormShow(Sender: TObject); begin if WebMode then begin UniHTMLFrame1.HTML.Text:=3D' id=3D"button1"'+ ' = onclick=3D"buttonClick('+TUniExtButton(UniButton1).ExtControl.JSName+')" = value=3D"HTML Button" />'; end; end; Pressing HTML button will call UniButton1 event. Quote
ganzqgy Posted August 29, 2015 Posted August 29, 2015 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);beginif 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);beginif EventName = 'ajaxRequest' then begin UniEdit1.Text := 'AAAAAA'; //Execution is successful(Show change) UniSession.Response := 'Ext.Msg.alert("","ok!");'; end;end; 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.