jQuery $.ajax(), $.post sending “OPTIONS” as REQUEST_METHOD in Firefox

前端 未结 23 2858
傲寒
傲寒 2020-11-22 14:38

Having trouble with what I thought was a relatively simple jQuery plugin...

The plugin should fetch data from a php script via ajax to add options to a

23条回答
  •  再見小時候
    2020-11-22 15:29

     function test_success(page,name,id,divname,str)
    { 
     var dropdownIndex = document.getElementById(name).selectedIndex;
     var dropdownValue = document.getElementById(name)[dropdownIndex].value;
     var params='&'+id+'='+dropdownValue+'&'+str;
     //makerequest_sp(url, params, divid1);
    
     $.ajax({
        url: page,
        type: "post",
        data: params,
        // callback handler that will be called on success
        success: function(response, textStatus, jqXHR){
            // log a message to the console
            document.getElementById(divname).innerHTML = response;
    
            var retname = 'n_district';
            var dropdownIndex = document.getElementById(retname).selectedIndex;
            var dropdownValue = document.getElementById(retname)[dropdownIndex].value;
            if(dropdownValue >0)
            {
                //alert(dropdownValue);
                document.getElementById('inputname').value = dropdownValue;
            }
            else
            {
                document.getElementById('inputname').value = "00";
            }
            return;
            url2=page2; 
            var params2 = parrams2+'&';
            makerequest_sp(url2, params2, divid2);
    
         }
    });         
    }
    

提交回复
热议问题