草庐IT

ajax-polling

全部标签

php - Zend Framework 中的跨域 ajax 操作

我的应用程序(A)需要通过AJAX(Fineuploader库)将文件上传到我的子域(B)(物理上是其他服务器)。我的解决方案是什么:在B上设置header以允许来自A的请求。请参阅以下Controller操作代码:publicfunctionimageAction(){$this->_response->setHeader('Access-Control-Allow-Origin','http://'.Zend_Registry::get('config')->main_server->path);$this->_response->setHeader('Access-Control

javascript - 未定义索引 : Error in ajax POST and/or php script?

我正在尝试将ajaxPOST发送到php文件,但是php文件发送了“未定义索引”的通知,并且php文件似乎从未收到我尝试发送的值。我一直在寻找为什么这不能正常工作的答案,所以希望有人能给我一些见解。我的javascript函数从html接收一个值,并接收到正确的值。(在本例中为“1”)functiondeleteMediaFromDatabase(val){$.ajax({url:'deleteMediaFromDatabase.php',data:{vals:val},type:'post',success:function(output){alert(output);},error

php - 下拉 Ajax onchange SonataAdminBundle Symfony2 问题

我正在尝试在SonataAdminBundle中实现onchange下拉列表。我的实体就像classBuilderHomePage{/***@varinteger**@ORM\Column(name="id",type="integer",nullable=false)*@ORM\Id*@ORM\GeneratedValue(strategy="IDENTITY")*/private$id;/***@var\Hello\FrontendBundle\Entity\MtContentType**@ORM\ManyToOne(targetEntity="Hello\FrontendBund

php - 在 Yii 中使用下拉列表的 Ajax Dependable texfile 不起作用

[已解决::更新了代码]有一个下拉列表和一个文本字段。提交的文本将由Ajax以Yii形式填写每个下拉选择。我需要通过AjaxURL将参数传递给Controller​​。当我通过URL传递静态参数时它正在工作。但是获取不到动态参数。我的表单::labelEx($model,'pp_store');?>dropDownlist($model,'pp_store',CHtml::listData(Branchmaster::model()->findAll(),'cm_branch','cm_branch'));?>findAll(),'cm_branch','cm_branch');ech

php - Wordpress 无法通过 ajax 请求加载正确的语言 mo 文件

我制作了一个wordpress主题并设置了两种语言(EN和DE)。我还制作了所需的mo文件。我一开始在wp-config.php中将德语定义为默认语言。一切正常,但AJAX请求有一些问题:它没有加载正确的语言文件。我的场景:我制作了一个通过AJAX请求数据的按钮/链接。像这样的东西(javascript):jQuery('#button').click(function(){jQuery.ajax({url:"http://myexampledomain.com/wp-admin/admin-ajax.php?lang=en",data:{action:'my_action',id:1

javascript - select2 多选ajax php

我尝试使用ajax填充我的多个select2,但我没有返回字段。这是我的HTML代码:Javascript:$('#instituicaoSel').select2({placeholder:"Escolhaumaoumaisinstituições",minimumInputLength:1,width:'100%',multiple:true,ajax:{url:basepath+"perfil/buscarInstituicoes",dataType:'json',quietMillis:100,data:function(term,page){return{q:term,pag

javascript - 奇怪的 jQuery Ajax 问题

我遇到了一个奇怪的ajax问题......好吧......不是问题,但你会看到/听到/读到这是我用来拉入页面的代码,您可以看到我正在使用“POST”来拉入它。//LoadpageinnerfunctionLoadPageInner($url,$cont){var$loading='Loading...';var$container=jQuery($cont);var$t=Math.round(newDate().getTime()/1000);varoptions={url:$url,cache:false,type:'POST',beforeSend:function(){$cont

php - yii : how to enable ajax if client insert space in textfield

在yii中,我在yii1.1.X的clientoptions中找到了validateOnChange和validateOnType但如果客户端在textField中输入空格,我需要启用ajax就像stackoverflow中的标签一样这是我的_form.phpbeginWidget('CActiveForm',array('id'=>'text-form',//Pleasenote:Whenyouenableajaxvalidation,makesurethecorresponding//controlleractionishandlingajaxvalidationcorrectly

javascript - CodeIgniter ajax 上传图片(ajax 有效,而不是 CodeIgniter)

我知道如何以传统方式通过ajax上传图片。但是,通过CodeIgniter的libraryupload我无法弄明白。但首先,让我告诉你,我根本不使用表格。if(!empty($_FILES)){$this->load->helper('global_helper');$config['upload_path']=base_url()+"public/images/";$config['file_name']=randomName();$config['allowed_types']="jpg|png|bmp";$config['max_size']='500';$config['ove

javascript - 将 php 文件与 AJAX 一起使用的最佳实践

我开始使用php进行Web开发,并且正在测试对php文件的jQueryajax调用以运行函数。但是我注意到,每次我使用AJAXPOST方法调用它时,php文件都会加载到资源中。防止这种情况发生的最佳解决方案是什么?此外,在从php中的单个文件执行多个函数调用(我习惯于在c#世界中调用web服务或web方法)时,是否有更好的编码实践可供使用?test.php'overflow','key'=>'value');echojson_encode($arr);}?>scripts.jsfunctionpostTest(){vardata={action:'test'};$.ajax({type