简体   繁体   English

jQuery的无法在IE11

[英]jquery not working in IE11

These are my methods for jQuery but it seems that it is not working in IE11, however the same code is working in firefox and chrome. 这些是我的jQuery方法,但似乎在IE11中不起作用,但是相同的代码在Firefox和chrome中也有效。

   function createCategory()
    {
    showLoading();

        $.post('<s:url value="/social/addEditCatSettings"/>',function(data){     
                hideLoading();
                $.prompt(data, {
                        title: "Add Categories",
                        buttons: { "Add": true, "Cancel": false },
                        submit: function(e,v,m,f){
                            if(v){
                                e.preventDefault();
                                saveUpdateCat();
                                }
                        }
                 });
            });
    }


  function saveUpdateCat(id)
    {
       var name = $('#catName').val();
       var name_sanitized = name.replace(some scritp....);
       if(name !== name_sanitized)
       {
            ShowMessage('Invalid input. Please try again.',true);
       }
       else
       {
       var type = false;

       jsonObj = [];
       item = {}
       item ["name"] = name;
       item ["type"] = type;


       if(typeof id != 'undefined')
        {
           item ["id"] = id;
        };


       if( btrim(name).length >0 )
        {
           item["mytoken"]='<s:property value="#session.mytoken"/>';

           $.post('<s:url value='/social/saveOrUpdateCatSettings' />',item,function(data){     

               if(data == 200)
                 {  
                     hideLoading(); 
                     $.fancybox.close();

                    if(typeof id != 'undefined')
                    {
                        ShowMessage('category updated successfully',false);
                    }
                    else
                     {
                        ShowMessage('category saved successfully',false);
                     }  
                     loadTabContent('MANAGECATS',profileId);
                 }
               else
                   {
                    ShowMessage('Please try again.',true);
                   }
             });




        }
        else
        {
            ShowMessage('Error,Please fill the required (*) fields',true);
            hideLoading();

        }
       }
    }

After hell of wasting hour, 在浪费时间的地狱之后

i replaced $post by $ajax and modified lines accordingly, it worked for me. 我用$ ajax代替了$ post,并相应地修改了行,它对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM