1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    8
    Vote Rating
    1
    chrislind is on a distinguished road

      0  

    Default Ajax post data store with json and jsonData

    Ajax post data store with json and jsonData


    Hi All,

    i want to write a data store, that gets its data by an ajax call. The ajax call has to be a http post message and has to contain some data in json format.

    Thats what I have so far:

    Code:
    Ext.define("MyApp.store.FileContent", {
        extend: "Ext.data.Store",
        model:'MyApp.model.FileContent',
        autoLoad: true,
    
        proxy: {
            actionMethods : {
                read   : 'POST'
            },
            type: 'ajax',
            defaultHeaders:{
                'Content-Type': 'application/json; charset=utf-8',
            },
            url : apiUrl + 'Files/GetFileInfo',
            jsonData : '{"file": "myfile"}'
        }
    });
    The call to the webservice works, but the variable "file" is always empty. What is wrong here?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Vote Rating
    827
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    First, you need to nest all the configs within the config object (model, autoLoad, proxy)

    Second, Ext.data.proxy.Ajax does not have a jsonData config. I understand Ext.Ajax.request has it but these are two different things that you are configuring.

    To send the file parameter you can use the extraParams config in the proxy:

    Code:
    extraParams : {
        file : 'myfile'
    }
    And now you will have a file parameter being sent in the request.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    29
    Vote Rating
    0
    jerrysolomon is on a distinguished road

      0  

    Default Using with ashx

    Using with ashx


    So, if I'm reading this thread correctly, the following code should send parameter id 'menu' = 'u' to lunch.ashx which can be read by the handler like:
    Dim strMenu As String = context.Request("menu")?
    Code:
    	var store = new Ext.data.Store({
    		autoLoad: true,
    		fields: ['LunchDate', 'LunchItem'],
    		proxy: {
    				type: 'ajax',
    				url: 'http://localhost/sencha/lunch.ashx',
    				extraParams: {
    					menu: 'u' 
    				}	
    				}
    	});

  4. #4
    Sencha User
    Join Date
    Nov 2013
    Posts
    7
    Vote Rating
    0
    varsha@123 is on a distinguished road

      0  

    Default


    Hi Suppose my url is "http://localhost:8080/SpyBox-REST/rest/user/getUserDetails" with method post and want to pass data as {"emailId":"user7@user.com","spyboxToken":"08005431727d87bdc6f63c2b9442c059"} I want to use store to get data bind it to user list.. I am getting data using Ext.Ajax.Request, but how to achieve same using store.. or how to assign this ajax response to store? var data = { "emailId": localStorage.emailId, "spyboxToken": localStorage.spyboxToken }; Ext.Ajax.request({ url: 'http://192.168.1.252:8080/SpyBox-REST/rest/user/getUserDetails', method: 'POST', timeout: 60000000, headers: { "Content-Type": "text/plain" }, jsonData: data, callback: function(options, success, response) { //localStorage.emailID=username.toLowerCase(); //sessionToken=username; //MyApp.app.emailID=username; /*console.log(response.responseText);*/ var obj = JSON.parse(response.responseText); console.log("Address: " +obj.data.address); console.log("City: " +obj.data.city); console.log("Contact: " +obj.data.contactNo); console.log("DOB: " +obj.data.dateOfBirth); console.log("EmailId : " +obj.data.emailId); console.log("Name : " +obj.data.name); });

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."