Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How To send JSON to Server

    Hi all!

    Is there an example to send JSON data to server using RPC?

    #2
    Any Help ????

    Comment


      #3
      I think you need a bit more detail on what you want to see.

      You can look in the showcase at the RestDataSource

      Comment


        #4
        What i want to see a JSON sent from client to the server

        Comment


          #5
          Change your operation type to POSTMESSAGE.

          Comment


            #6
            Thanks davidj6 for your quick response.

            I will be thankful if you could supply me with example.

            Comment


              #7
              Take a look at this similar thread.

              Comment


                #8
                Thanks for your help davidj6.

                Comment


                  #9
                  What about in Javascript? The majority of these examples are for developing your app in SmartGWT. I am simply using SmartClient javascript framework and I want to make a simple POST request for some data. But how?

                  Here's my post request:

                  Code:
                  isc.DynamicForm.create({
                  			ID:"output",
                  			width:600,
                  			fields:[
                  				{name:"outputText", title:"SessionID", type:"text"},
                  				{name:"submitBtn", title:"Click Me", type:"button", click:"handleSubmitBtnClick();"}
                  			]           
                  		});   
                  		
                  		function handleSubmitBtnClick() {
                  			isc.RestDataSource.create({
                  				ID:"getSysType",
                  				dataFormat:"json",
                  				dataTransport:"xmlHttpRequest",
                  				operationBindings:[
                  					{operationType:"fetch", dataURL:"/rest/request/"+session, dataProtocol:"postParams"}
                  				],
                  				transformRequest: function (dsRequest) {
                  					dsRequest.contentType = "application/json";
                  					dsRequest.httpMethod = "POST";
                  					dsRequest.httpHeaders = { "Accept" : "application/json" };
                  				    var params = {
                  						"call" : "SysInfo_getInfo",
                  						"params" : {
                  							"name" : "info.system.type"
                  						}
                  					}                            
                  					return isc.addProperties({}, dsRequest.data, params);
                  				},
                  				transformResponse: function (dsResponse, dsRequest, data) {
                  					if ( data["_rv"] == 0 )
                  					{
                  						alert("value:"+data);
                  					}
                  				}
                  			});
                  			
                  			isc.RestDataSource.get("getSysType").fetchData(null, getSysTypeHandler);
                  		}	                                                                        
                  		
                  		function getSysTypeHandler(data)
                  		{
                  			alert("GetSysTypeHandler:"+data);
                  		}
                  Last edited by rfender; 2 Nov 2011, 08:04.

                  Comment

                  Working...
                  X