的X编辑Ajax调用不处理指定的URL [英] x-editable ajax call does not process the designated url

查看:190
本文介绍了的X编辑Ajax调用不处理指定的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯使用引导程序使用X-编辑和IM试图得到它的工作,一旦保存按钮从x编辑点击PHP文件应该被执行。

我用尽一切都在我的知识来解决这个问题,但即时通讯不是一个铁杆的JavaScript程序员,所以将其更改为JSON来试试看是我的观点有点费力。

香港专业教育学院读的X可编辑的文档,这应该是与它的工作方式。

因此​​,这里的HTML:

 < A HREF =#级=用户名和GT;超级用户< / A>
 

JavaScript的:

  $ .fn.editable.defaults.mode =内联;

      $('用户名)。编辑({
           类型:文本,
           PK:1,
           网址:post.php中,
         });
 

一旦在 post.php中缺少的X编辑给出了一个错误,但是如果它认为它什么都不做的PHP文件。 从PHP文件的内容是不相关的,因为只有与测试控制台登录它。

控制台日志没有被执行,我不能明白,为什么它不工作,我见过的StackOverflow等1或2的问题,像的事情之一,但是没有用的全部信息。

这是有史以来第一次,我不得不问的东西在互联网上,所以我希望有人能帮助我这一个。

我试着像改变网​​址本地主机/目录的/ etc 但是没有效果。 还设置 / posturl ,并增加无功 posturl =post.php中; 无助

哦,我测试过的所有资源:但如果它帮助这里:

 <! - 乐风格 - >
<  - !jQuery的 - >
&所述;脚本的src =的http://$c$c.jquery.com/jquery.js>&所述; /脚本>
&所述;! -  Sharre  - >
<脚本SRC =的recources /资产/ JS / jquery.sharrre-1.3.4.js>< / SCRIPT>
<! -  Minnified引导 - >
<脚本SRC =的recources /资产/分钟/ JS / bootstrap.min.js>< / SCRIPT>
<! - 自定义CSS  - >
<链接HREF =的recources /资产/ CSS / pagestyle.css相对=样式>
<! -  X  - 编辑 - >
<链接HREF =的recources /资产/ CSS /引导-editable.css相对=样式>
<! - 外部链接 - >
&LT;脚本src="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.4.4/bootstrap-editable/js/bootstrap-editable.min.js"></script>
 

解决方案

使用发送参数,因为它可以决定的策略的将数据发送到服务器。它可以是自动 | 总是 | 永远。当自动数据将仅 PK 发送服务器和网​​址定义的,否则新值被本地存储

您可以将其设置为所有输入这个code:

  $ fn.editable.defaults.send =总是;
 

,或自定义每个输入相关的策略是这样的:

  $('用户名)。编辑({
    发送:总是
});
 

Im using bootstrap with x-editable and im trying to get it working once the save button from x-editable is clicked the php file should be executed.

Ive tried everything within my knowledge to fix this but im not a hardcore javascript programmer so changing it to Json to give it a try is to my perspective a little much effort.

Ive read the documentation of x-editable and this should be the way to work with it.

So here is the html:

  <a href="#" class="username">superuser</a> 

The Javascript:

      $.fn.editable.defaults.mode = 'inline';

      $('.username').editable({
           type: 'text',
           pk: 1,
           url: 'post.php',
         });

Once the post.php is missing x-editable gives an error , however if it sees the php file it does nothing. the contents from the php file are irrelevant because there is only a console log with test in it there.

The console log is never executed and i cant figure out why it is not working, I've seen 1 or 2 problems like thing one on Stackoverflow etc however no use full information.

This is the first time ever i had to ask something on the internet so i hope someone can help me with this one.

I've tried things like changing the url to localhost/dir/etc however no effect. also setting /posturl, and adding var posturl = "post.php"; didn't help

oh and I've tested all the resources : but if it helps here:

<!-- Le styles -->  
<!-- jQUERY -->
<script src="http://code.jquery.com/jquery.js"></script>
<!-- Sharre -->
<script src="recources/assets/js/jquery.sharrre-1.3.4.js"></script>
<!-- Minnified bootstrap -->
<script src="recources/assets/min/js/bootstrap.min.js"></script>
<!-- Custom CSS -->
<link href="recources/assets/css/pagestyle.css" rel="stylesheet">
<!-- X - Editable -->
<link href="recources/assets/css/bootstrap-editable.css" rel="stylesheet">
<!-- External link -->
<script src="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.4.4/bootstrap-editable/js/bootstrap-editable.min.js"></script>

解决方案

Use send parameter as it can determine Strategy for sending data to server. It Can be auto | always | never. When 'auto' data will be sent on server only if pk and url defined, otherwise new value will be stored locally.

You can set it for all inputs by this code:

$.fn.editable.defaults.send = "always";

Or Customize each input for related strategy like this:

$('.username').editable({
    send: 'always'
});

这篇关于的X编辑Ajax调用不处理指定的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆