Question with Ajax?

i am testing <Sending GET/POST request with dhtmlxAjax> code.
So at test1.php :

Parameters:  GET POST Use Synchronous Mode

and at test.php:

<?php if ($_POST[params]=="") echo "NO_POST "; else echo "YES_POST "; if ($_GET[params]=="") echo "NO_GET "; else echo "YES_GET "; ?>

[b]The problem is that the test.php’s output is
NO_POST
NO_GET

which means that “params” is not posted and that params value doesn’t pass to URLto GET it from the test.php page.
Also with ie8 the output is:

Request Sent1
We Got Response\n\n

but with mozilla :

Request Sent1
Response contains no XML

Can anyone help me with test.php and with browsers?[/b]

I think we have the same problem. When I send a request using the ajax object in firefox, I have no responseXML. With IE everything works fine.

Using firebug I can see that the request sent by the ajax object is an OPTIONS request instead of a GET request.

Can someone of the dhtmlx staff explain us where is the problem.

Using firebug I can see that the request sent by the ajax object is an OPTIONS request instead of a GET request.

Can you provide a sample to recreate the problem

Alexandra, I’m getting the results with Chrome that Julian is getting with Firefox.

The message from outputResponse() when run under Chrome says the loader.xmlDoc.responseXML object is null. IE, however, is showing that the loader.xmlDoc.responseXML object is not null.

My code is very similar to that of k…, except that I’m calling a known-good web service within my domain.

Is there an explanation, please? Thank you.

Hello,

here is the working sample:
dhtmlxAjax/samples/01_samples_of_usage/01_send_request.html

Please provide the complete demo.

Alexandra, the code below that I’ve been testing has been very closely based on the sample. It returns a SOAP response body using IE, but nothing in Chrome. Thanks in advance for any help you might offer.

[code]

DHTMLX Ajax test

Parameters:  GET POST Use Synchronous Mode

[/code]

Make sure that there is not a whitespace before <?xml declaraton (the declaration must be the first text in the output).

Thank you for your reply, Alexandra. No, there is no initial whitespace in the response body. I’ve tried my code with a couple of different known-good web services, written by different companies, and have gotten the same results - a response body comes back using IE, but none using Chrome.

Kindly advise, please? Thank you.

Alexandra, the next function worfs fine in IE. We use it to load the name of provinces of Spain in an array.

‘Provincias’ is a global variable in our app.

[code]function cargaProvincias() {

var ABC = 'abcdefghijklmnñopqrstuvwxyz';
var url;
var params;

for(var i=0;i<ABC.length;i++) {
	url = "http://www.cartociudad.es/wfs-provincia/services?";
	params = "SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&";
	params = params + "NAMESPACE=xmlns(app=http://www.deegree.org/app)&";
	params = params + "TYPENAME=app:Entidad&"
	params = params + "FILTER=<Filter><PropertyIsLike wildCard='*' singleChar='_' escapeChar='|'><PropertyName>nombreEntidad/nombre</PropertyName><Literal>";
	params = params + ABC.charAt(i) + "*";
	params = params + "</Literal></PropertyIsLike></Filter>";

	var loader = dhtmlxAjax.getSync(url + params);
				
	if (loader.xmlDoc.responseXML != null) {
		var nResults = loader.doXPath("/ResultCollection/gml:featureMember").length;
			if(nResults != 0){
				for(var j=0; j<nResults; j++){
					var name = loader.doXPath("/ResultCollection/gml:featureMember[" + j +"]/Entidad/nombreEntidad/nombre");
				if(name.length != 0) provincias[provincias.length] = name.item(0).text;
			}
		}
	}
}

}
[/code]

Thanks in advance

Ajaxian,

could you provide an example of generated xml for testing?

Julian,

what is the problem you have faced ? It seems that you didn’t mentioned it…

Greetings, Alexandra,

My apologies - I’m not sure I understand your request. Do you want a copy of the response body XML, please?

Thank you.

Greetings,

pm_project.do generates some xml. Could you provide the example of problematic xml or link to the page.

Alexandra the description of the problem is in the second reply.

"I think we have the same problem. When I send a request using the ajax object in firefox, I have no responseXML. With IE everything works fine.

Using firebug I can see that the request sent by the ajax object is an OPTIONS request instead of a GET request.

Can someone of the dhtmlx staff explain us where is the problem."

The next function worfs fine in IE. We use it to load the name of provinces of Spain in an array.

‘Provincias’ is a global variable in our app.

[code]function cargaProvincias() {

var ABC = ‘abcdefghijklmnñopqrstuvwxyz’;
var url;
var params;

for(var i=0;i<ABC.length;i++) {
url = "http://www.cartociudad.es/wfs-provincia/services?";
params = “SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&”;
params = params + “NAMESPACE=xmlns(app=http://www.deegree.org/app)&”;
params = params + “TYPENAME=app:Entidad&”
params = params + “FILTER=nombreEntidad/nombre”;
params = params + ABC.charAt(i) + “*”;
params = params + “”;

  var loader = dhtmlxAjax.getSync(url + params);
           
  if (loader.xmlDoc.responseXML != null) {
     var nResults = loader.doXPath("/ResultCollection/gml:featureMember").length;
        if(nResults != 0){
           for(var j=0; j<nResults; j++){
              var name = loader.doXPath("/ResultCollection/gml:featureMember[" + j +"]/Entidad/nombreEntidad/nombre");
           if(name.length != 0) provincias[provincias.length] = name.item(0).text;
        }
     }
  }

}
}[/code]

Hello,

we need a complete demo - the sample that contains all necessary files and static xml.

Alexandra I can’t give you the complete app. I’ve prepared a mini demo, it only needs the javascript file dhtmlxcommon.js. I’m using the copy of the file located at the codebase dir of the dhtmlAjax dir from the standard edition of the dhtmlxSuite 2.6.

I sent you a zip file with a mini demo.

Thanks for your efforts.
demo.zip (6.39 KB)

Please see the post viewtopic.php?f=7&t=16720 possibly it’ll resolve the problem

Alexandra the xml sent by the server is correct. I’m sure because I have sent the requests typing them like an URL in IE and Firefox, and both renders the xml well.

I think the problem is not in the xml sent by the server. I remind you the following:

When I send a request using the ajax object in firefox, I have no responseXML. With IE everything works fine.

Using firebug I can see that the request sent by the ajax object is an OPTIONS request instead of a GET request.

So, in my case, it seems that the Ajax Object send an OPTIONS request to the server instead of a GET request when Firefox is used.

Could you provide a link to the problematic page ?

For example:

http://www.cartociudad.es/wfs-provincia/services?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&NAMESPACE=xmlns(app=http://www.deegree.org/app)&TYPENAME=app:Entidad&FILTER=<PropertyIsLike%20wildCard=’’%20singleChar=’_’%20escapeChar=’|’>nombreEntidad/nombrea