Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 25th, 2007, 10:36 AM
Registered User
 
Join Date: Jan 2007
Location: FPT, , Vietnam.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error javascrip

Hi All
Here is my file javascrip
--------------------------
var oPopup = window.createPopup();
            function ConratulationAdd()
            {
                var oPopBody = oPopup.document.body;
                oPopBody.style.backgroundColor = "lightyellow";
                oPopBody.style.border = "solid black 1px";
                oPopBody.innerHTML = "Thanks you ! Your Cart have been add To Cart.";
                oPopup.show(event.clientX-50, event.clientY-60, 200, 50, document.body);
            }

            function hamxuly(objAjaxTest)
            {
            //alert(objAjaxTest.DOMDocument)


            var rootNode = objAjaxTest.SelectSingleNode('Products');
            var products = rootNode.childNodes;
            var str ="<table border='0'>";
            str=str + "<tr><td width='200'> DESIGNATION</td><td width='30'> QTE</td><td width='30'>TOTAL</td></tr>"
            var mQuanlity=0;
            var mTotal=0;
            for ( var j = 0 ; j < products.length ; j++ )
            {
                str=str + "<tr>"
                var product = products[j] ;
                var ProductID = (product.attributes.getNamedItem('ProductID')!=nul l)?product.attributes.getNamedItem('ProductID').va lue:"" ;
                var ProductName = (product.attributes.getNamedItem('ProductName')!=n ull)?product.attributes.getNamedItem('ProductName' ).value:"" ;
                var Quanlity = (product.attributes.getNamedItem('Quanlity')!=null )?product.attributes.getNamedItem('Quanlity').valu e:"" ;
                var Total = (product.attributes.getNamedItem('Total')!=null)?p roduct.attributes.getNamedItem('Total').value:"" ;
                mQuanlity= mQuanlity + Number(Quanlity);
                mTotal=mTotal + Number(Total);
                str=str + "<td width='200'>" + "" + ProductName + "" + "</td>"
                str=str + "<td width='30' align='center'>" + "" + Quanlity + "" + "</td>"
                str=str + "<td width='30' align='center'>" + "" + Total + "" + "</td>"
                str=str + "</tr>"
             }
            str=str + "<tr><td align='right'>" + ""+" Total" + "</td><td width='30' align='center'>" + "" + mQuanlity + "" + "</td><td width='30'align='center'>" + "" + mTotal + "" + "</td></tr>"
            str= str + "</table>"
            document.getElementById("myBag").innerHTML=str

            }

//--------------------
var AjaxTest = function()
{

}

AjaxTest.prototype.GetHttpRequest = function()
{
    //alert("Thanks you ! To continue please press ok"); dua cai alert nao vao thi ok

    ConratulationAdd();


    if ( window.XMLHttpRequest )
    { // Gecko
        return new XMLHttpRequest() ;
    }
    else if ( window.ActiveXObject ) // IE
    {
            try{
                return new ActiveXObject("MsXml2.XmlHttp") ;

            }
            catch(e)
            {
            return new ActiveXObject("Microsoft.XMLHTTP") ;
            }
    }

}

//---------------------
AjaxTest.prototype.GoiAjaxTest_Text = function(urlToCall,hamXuLyKetqua)
{


    var objAjaxTest = this ;
    var bAsync = ( typeof(hamXuLyKetqua) == 'function' ) ;
    var oXmlHttp = this.GetHttpRequest();
    oXmlHttp.open( "GET", urlToCall, bAsync ) ;
    if ( bAsync )
    {
        oXmlHttp.onreadystatechange = function()
        {

            if ( oXmlHttp.readyState == 4 )
            {
                objAjaxTest.DOMDocument = oXmlHttp.responseXML;

                if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
                  {


                    hamXuLyKetqua(objAjaxTest) ;
                  }
                else
                    alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ;
             }
        }
    }
    oXmlHttp.send(null) ;
    //alert(

}

AjaxTest.prototype.SelectSingleNode = function( xpath )
{

    if ( document.all )
    {
        // IE

        return this.DOMDocument.selectSingleNode( xpath );
    }
    else // Gecko
    {
        var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument,
                this.DOMDocument.createNSResolver(this.DOMDocument .documentElement), 9, null);

        if ( xPathResult && xPathResult.singleNodeValue )
            return xPathResult.singleNodeValue ;
        else
            return null ;
    }
    oPopup.hide();
}
-------------------------------
Here is my javascrip at my code :
function ajax_do(url) {

                    url="<%= Page.ResolveUrl("~/DesktopModules/Asieco_ProductsView/AddData.aspx") %>"+url;

                    /*
                    var jsel = document.createElement('script');
                    jsel.type = "text/javascript";
                    jsel.src = url;
                    */
                   var ajaxtest=new AjaxTest();
                   ajaxtest.GoiAjaxTest_Text(url,hamxuly);

            }
function doAdd(ProductID)
            {
                var sGetText;
                sGetText="txt" + ProductID;
                var intQuanlity=document.getElementById("txt"+ProductI D).value;
                if (isNaN(intQuanlity))
                {
                    alert("You have to input number");
                    return;
                }
                ajax_do("?id="+ProductID+"&txt"+ProductID+"="+intQ uanlity);
            }
when function "doadd" run. at my site( asieco.net) then it's Error : XML request error.
But this site can run at my local machine well
Please help me fix this error

Thanks
phuong

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Query Error & Run-Time Error 3022 DavidWE Access 1 July 31st, 2008 11:17 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM
How can I pass a variable from php to Javascrip aneesh_sunu@yahoo.co.in PHP How-To 2 May 17th, 2007 06:50 AM
checkbox validation on client side using Javascrip sansircar ASP.NET 1.0 and 1.1 Professional 0 October 17th, 2005 07:43 PM
How do we exit from a function in JavaScrip ? MisbahAnsari Javascript 1 November 28th, 2003 07:10 PM



All times are GMT -4. The time now is 02:28 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.