简体   繁体   English

使用JavaScript在div中加载内容

[英]Load content in div using javascript

Currently I am facing a problem with Jquery ajax call. 目前,我正在面对Jquery ajax调用的问题。 The Ajax call in my jsp takes more time to load data where as javascript form submit takes less time. 我的jsp中的Ajax调用花费更多的时间来加载数据,而javascript表单提交花费的时间更少。

Using javascript form submit i am unable to load the content form result in another tab. 使用JavaScript表单提交,我无法在另一个选项卡中加载内容表单结果。 Could any one help me on this 有人可以帮我吗

Javascript Function Javascript功能

         function getCircuitMaintenanceDetails(event,refno)
          {   
              var eve = event;
              var ref_no = refno;
              var url = "circuitMaintenanceDetails.do?EVENT_KEY="+eve+"&REF_NO="+ref_no; 
              document.getElementById('sessReferenceId').value=refno;
             $.ajax({
                  type:'post',
                  cache:false,
                  url:url,
                  beforeSend: function ( xhr ) {
                      $('#content02').html('<div class="loading"><center><img src="../images/ajax-loader.gif" alt="Loading..." /><center></div>');
                    },
                   success:function(data){
                       window.scrollTo(0,0); 
                       $('#content02').html(data);                              
                   }
              }); 


          }

Above javascript function loads data in another tab using ajax call. 上面的javascript函数使用ajax调用将数据加载到另一个标签中。 It takes more time 需要更多时间

The jsp code has been placed in http://jsfiddle.net/mJ8m3/ 该jsp代码已放置在http://jsfiddle.net/mJ8m3/

I am using IE8 and Jquery 1.7.1 in my jsp file. 我在我的jsp文件中使用IE8和Jquery 1.7.1。 Any one guide me how to improve the performance of Ajax call or could guide me how to load data in second tab ie (content02) tab using javascript function. 任何人都可以指导我如何提高Ajax调用的性能,或者可以指导我如何使用javascript函数在第二个选项卡(即(content02)选项卡)中加载数据。

If I use document.forms[0].submit is loading the content in the same tab instead of tab2. 如果我使用document.forms [0] .submit,则将内容加载到同一选项卡而不是tab2中。

After Submitting the form in javascript I am unable to load the content in another tab defined using div tag 用javascript提交表单后,我无法在使用div标签定义的另一个标签中加载内容

Any one can help me in this problem. 任何人都可以帮助我解决这个问题。 Really need a solution for this. 确实需要一个解决方案。 Help me to increase the speed 帮我加快速度

您可以使用jquery的load()方法。

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

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