简体   繁体   English

如何通过Ajax将default.php中的值传递给view.html.php-joomla3.x

[英]How to pass a value from default.php to view.html.php through ajax - joomla3.x

I want to pass a value to view.html.php from default.php. 我想将值从default.php传递给view.html.php。

This is in Joomla 3.x 这是在Joomla 3.x中

  • folder/tmpl/default.php 文件夹/ TMPL /如default.php
  • folder/view.html.php 文件夹/ view.html.php

default.php 如default.php

<input placeholder="Enter a value" type="text" id="field-5" >

<script type="text/javascript">
$(document).ready(function() {
   $("#field-5").keyup(function (e) { 
      var exam = $(this).val(); 
      $.post('http://localhost/folder/folder/folder/folder/folder/view.html.php', {'value':exam});  
   });
});
</script>

view.html.php view.html.php

$value = $_REQUEST['value'];
echo $value;

i need that $value for filtering a data table, i dont know if this is working or this the right code, or its just i need to refresh my data table and i dont know how. 我需要该$ value来过滤数据表,我不知道这是否有效或正确的代码,或者只是我需要刷新我的数据表而我不知道如何。

Thanks in advance. 提前致谢。

It doesn't work this way. 这样行不通。 Your URL in the ajax call must be something like the following: 在ajax调用中,您的URL必须类似于以下内容:

JURI::root().'index.php?option=com_your_extension&view=view_name'

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

相关问题 Joomla 2.5从view.html.php更改html标题 - Joomla 2.5 change html title from view.html.php 从default.php隐藏的传递变量不起作用-joomla 3 - passing variable as hidden from default.php is not working - joomla 3 在joomla组件中的default.php内部查看路径 - View path inside default.php in joomla component 如何将$ _GET [&#39;&#39;]值从mod_modulenamet / mpl / default.php中的$ document-&gt; addStylesheet()转换为joomla模块的css.php文件 - How to $_GET [' '] value from $document->addStylesheet() in mod_modulenamet/mpl/default.php to css.php file of joomla module Joomla。 如何在default.php中编辑菜单的链接? - Joomla. How to edit the link of the Menu in default.php? Joomla 2.5在default.php中加载javaScript文件 - Joomla 2.5 Loading javaScript Files inside default.php 在Virtuemar选项卡/ default.php / Joomla 3.7.5中插入Chronoforms - Insert Chronoforms in Virtuemar tabs / default.php / Joomla 3.7.5 joomla 2.5模块:如何将foreach循环放入tmpl / default.php - joomla 2.5 module: how to foreach loop put in tmpl/default.php 如何在Joomla 3 default.php文件中更改菜单类以模仿自定义菜单类 - How to change the menu classes in Joomla 3 default.php file to mimic custom menu classes 如何通过Ajax将图像从html传递到php - How to pass image from html to php through ajax
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM