PDA

View Full Version : Probelm with GET



Dannesart
29 Nov 2011, 7:19 AM
I got a store:

Ext.define('Intelliplan.Data.Crm.SalesActivity.Query.GetPlannedSalesActivityCount', {
extend: 'Intelliplan.Base.Data.Query',
proxy: Ext.create('Intelliplan.Base.Proxy.Standard', {
url: Intelliplan.Api.BaseUrl + '/Crm/SalesActivity/GetPlannedSalesActivityCount'

}),
fields: [
{ name: 'countPlannedSalesActivities', type: 'int' }

]
});

And in y dialog I wanted to create this and post some parameters:

loadStores: function (custKey, salesPersonUserId) {
var query = Ext.create('Intelliplan.Data.Crm.SalesActivity.Query.GetPlannedSalesActivityCount');
query += '&custKey=' + custKey;//this.getStore().getAt(index).get('custKey');
query += '&salesPersonUserId=' + this.salesPersonUserId;//this.getStore().getAt(index).get('salesPersonUserId');
var errorMessage = 'Error loading data';

Intelliplan.Util.Ajax.get(query, errorMessage, this);
},

"The server expect

salesPersonUserId




custKey



"
But I recieve: ""NetworkError: 404 Not Found - http://localhost/Intelliplan/Application/Dashboard/%5Bobject%20Object%5D&custKey=undefined&salesPersonUserId=undefined?_dc=1322579254295""

Any ideas? Thank you!

mitchellsimoens
29 Nov 2011, 7:27 AM
The browser is telling you that it could not resolve the url.

Dannesart
29 Nov 2011, 7:45 AM
Any idea?

skirtle
29 Nov 2011, 8:13 AM
Your query-building process starts off like this:


var query = Ext.create('Intelliplan.Data.Crm.SalesActivity.Query.GetPlannedSalesActivityCount');

At this point query is an object. You then try to += a string to query. That will implicitly convert the object to a string, specifically the string "[Object object]".

Judging by the URL, both custKey and this.salesPersonUserId are undefined.

So query ends up being this:


"[Object object]&custKey=undefined&salesPersonUserId=undefined"

You then pass that string to your Ajax function. What happens next I have no idea but it's already completely hosed.