CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005

    [RESOLVED] System Error

    I'm new to ajax, and i try to make a simpe test but i alwas got the system error -1072896748 when i'm calling a page use sing the GET method like : http.open('GET', 'script.php?action=test');
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Document sans nom</title>
    function createRequestObject(){
    	var request_o; //declare the variable to hold the object.
    	var browser = navigator.appName; //find the browser name
    	if(browser == "Microsoft Internet Explorer"){
    		/* Create the object using MSIE's method */
    		request_o = new ActiveXObject("Microsoft.XMLHTTP");
    		/* Create the object using other browser's method */
    		request_o = new XMLHttpRequest();
    	return request_o; //return the object
    /* You can get more specific with version information by using 
    	Which will extract an integer value containing the version 
    	of the browser being used.
    /* The variable http will hold our new XMLHttpRequest object. */
    var http = createRequestObject(); 
    /* Function called to get the product categories list */
    function test(){
    	/* Create the request. The first argument to the open function is the method (POST/GET),
    		and the second argument is the url... 
    		document contains references to all items on the page
    		We can reference document.form_category_select.select_category_select and we will 		
    		be referencing the dropdown list. The selectedIndex property will give us the 
    		index of the selected item. 
    	http.open('GET', 'script.php?action=test');
    	/* Define a function to call once a response has been received. This will be our
    		handleProductCategories function that we define below. */
    	http.onreadystatechange = handle; 
    	/* Send the data. We use something other than null when we are sending using the POST
    		method. */
    /* Function called to handle the list that was returned from the internal_request.php file.. */
    function handle(){
    	/* Make sure that the transaction has finished. The XMLHttpRequest object 
    		has a property called readyState with several states:
    		0: Uninitialized
    		1: Loading
    		2: Loaded
    		3: Interactive
    		4: Finished */
    	if(http.readyState == 4){ //Finished loading the response
    		/* We have got the response from the server-side script,
    			let's see just what it was. using the responseText property of 
    			the XMLHttpRequest object. */
    		var response = http.responseText;
    		/* And now we want to change the product_categories <div> content.
    			we do this using an ability to get/change the content of a page element 
    			that we can find: innerHTML. */
    		//document.getElementById('product_cage').innerHTML = response;
    <a href="#" onclick="test()">[test]</a>
    <div id="main"></div>
    switch($_REQUEST['action']) {
    	case 'test':
    		echo "main\ntest effectué";
    Louis-Philippe Frenette
    Arobas Informatique Granby

  2. #2
    Join Date
    Aug 2005

    Re: System Error

    finaly found the error.
    For french, you have to change the encoding if you have specials characters like (é,è,ê,ë,ç,...) here's an exemple :
    function send($what) {
    	echo  mb_convert_encoding($what, "UTF-8", "ISO-8859-1");
    switch($_REQUEST['action']) {
    	case 'test':
    Louis-Philippe Frenette
    Arobas Informatique Granby

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.