Question

In Java script when we send GET request it goes without adding any parameter, But in EXT-JS it auto add CallBack parameter. (i checked with Wireshark & firebug)

we are able to see xml on browser on Juniper MFC URL, because it sends GET request, but browser show 404 error when REQUEST sent with any parameter like 'callback parameter' (acc to Firebug, browser & wireshark).

So i need to create a new proxy Extend from ScriptTagProxy, in that modified load function. Please tell me how i can do that.

I have done the following but no luck.

        var _Proxy = Ext.extend(Ext.data.MyScriptTagProxy({
         url: 'http://IP:PORT/App',
         method: 'GET',
         nocache: false,
         restful: true 
         }); 

 Ext.define('Ext.data.MyScriptTagProxy' {   
 extend: 'Ext.data.ScriptTagProxy',
 constructor:function(cnfg){
 this.callParent(arguments);//Calling the parent class constructor
      this.initConfig(cnfg);//Initializing the component
      this.on('beforerender',this.beforeRender);
 }});

IF there is another solution for topic also please suggest.

Was it helpful?

Solution 2

Finally I found the solution,

My prob :- Mentioned in Qus.

My Solution :- I send Request to Server via AJAX, than save the responsetext, Convert the same into XML via jQuery. then give this value to data field of XMLStore. since server is in another domain, so also disabled POP-Up blocker. tool using: - ExtDesigner

My code :- (Sorry for code quality)

var doc = sendReq();

function sendReq() {
    var xmlstr = SendRequest();
    var doc1 = new ActiveXObject("Microsoft.XMLDOM");

    doc1.async = "false";
    doc1.loadXML(xmlstr);
    alert(" Xml is parsing ... ");

    return doc1;
}

function SendRequest() {
    var Url = "http://SERVER_IP:PORT/XMLPATH";

    xmlHttp = new XMLHttpRequest();
    xmlHttp.onreadystatechange = ProcessRequest;
    xmlHttp.open("GET", Url, false);
    xmlHttp.send();

    return xmlHttp.responseText;
}

function ProcessRequest() {
    if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
        if (xmlHttp.responseText != "Not found") {
            var str = xmlHttp.responseText;
        }
    }
}

MyStore = Ext.extend(Ext.data.XmlStore, {
    constructor: function (cfg) {
        cfg = cfg || {};
        MyStore.superclass.constructor.call(this, Ext.apply({
            storeId: 'MyStore',
            data: doc,
            record: 'resourcePool',
            autoLoad: true,
            fields: [{
                name: 'bandwidth',
                type: 'float'
            }, {
                name: 'name',
                type: 'string'
            }]

        }, cfg));
    }
});

new MyStore();

OTHER TIPS

Here is the problem: in order to use JsonP (ScriptTagProxy) your server needs to wrap the response into a javascript method callback and return valid JavaScript code. Any other format will fail because the request is executed using <script> tags and the response will be interpreted by the browser's JavaScript engine.

Furthermore, the client needs to be able to match the callback to the original request - this is why ExtJs sends the name of the callback method, which is unique for that specific request.

But before we delve into this, are you aware that JsonP requires the server to prepare the response data accordingly. Does your server (Juniper MFC) support this?

As an alternative you can go with CORS which was introduced as an alternative to JsonP. This technique is less invasive and requires a special HTTP header configuration for your HTML document(s) on the server. ExtJs supports CORS via Ext.data.Connection#cors.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top