Jump to content

Ajax/Post Problem


Fimeral

Recommended Posts

functions
[code]function snifDoc(lyr)
{
    if(document.all)
    {
        return document.all[lyr];
    } else if(document.getElementById) {
        return document.getElementById(lyr);
    } else if(document.layers) {
        return document.layers[lyr];
    }
}

function makeRequest()
{
    if(window.XMLHttpRequest)
    {
        req = new XMLHttpRequest();
        if (req.overrideMimeType) {
            req.overrideMimeType('text/xml');
        }
    } else if(window.ActiveXObject){
        try {
            req = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
            try {
                req = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {}
        }
    } else {
        req = false;
    }
    return req;
}

function yolla(frm, url, lyr)
{
    str = "";
    for(i=0;i<document.forms[frm].elements.length;i++)
    {
        if(document.forms[frm].elements[i].name) {
          str += document.forms[frm].elements[i].name +"="+ document.forms[frm].elements[i].value+"&";
        }
    }
     if(req = makeRequest())
     {
         req.onreadystatechange = function () {

switch(req.readyState)
    {
        case 4:
                if(req.status == 200) {
                    snifDoc(lyr).innerHTML = "Başarıyla Değiştirildi";
                } else {
                    snifDoc(lyr).innerHTML = 'İşlem başarısız!';
                }
            break;
    } // END switch
}


         req.open('POST', url, true);
         req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
         req.send(str);
     }
}
[/code]
and html form
[code]<form name='namechange' onsubmit='return false;'>
         <input type='text' name='ftpname' value='$row[1]' />
  <input type='hidden' name='id' value='$row[0]' />
            <input type='submit' value='Gönder' onclick='yolla('namechange', 'name_change.php', 'warn');' />
     </form>[/code]
what is wrong with these codes?  :(
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.