我正在学习php/xml/json以及其他所有内容,我正在通过API来处理某些事情.他们有文档,但我仍然没有得到API的工作方式.他们给你一个GET链接和API密钥,我知道你应该把API密钥放在请求链接中
我该如何称呼此链接?当它给你一个样本响应时它意味着什么?
如果您的请求正确,是否应该响应?
我有点clueluess?
谢谢
我有一个div左浮动和一个div浮动右,我想改变背景颜色.它会改变背景,但它会在浮动div之前停止.当我把它们取下时,它会继续保持我想要的正确背景颜色.
<div style='clear:both;border-bottom:3px solid #999;border-top:#333 solid thin;background:#D7E7E8;position:relative;'>
<div style='width:1091px;margin:0 auto;margin-top:70px;'>
<div style='float:left;width:200px;border:thin solid black;margin-bottom:50px;position:relative;'>
float LEFT
</div>
<div style='float:right;border:thin solid black; width:800px;border:thin solid black;margin-bottom:50px;position:relative;'>
float RIGHT
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
谢谢!
如果我想鼠标输入div,则会显示一个元素,然后当mouseleave,元素消失时.
我在mouseenter中有一个click功能,所以点击时会出现一个下拉菜单.
我希望下拉菜单和元素即使在mouseleaves时也能保持活动状态.因此,当有点击事件时,我希望鼠标在这种情况下不适用.用户必须再次单击该元素或页面上的任何位置,以使元素和下拉菜单消失.
但是我想保持mouseleave功能正常工作,所以如果用户鼠标移动div,元素将显示,他们可以再次点击它.
我目前有这样的东西,但我不知道如何使鼠标在点击时不适用
$(".div").mouseenter(function(){
$(".element",this).show();
$(".element").click(function(){
$(".dropdown").show();
return false;
});
}).mouseleave(function(){
$(".element",this).hide();
});
Run Code Online (Sandbox Code Playgroud)
编辑:
HTML
<div class='div'>
<div class='element' style='display:none;'>
boxed element
</div>
<div class='dropdown' style='display:none;'>
menu
</div>
</div>
Run Code Online (Sandbox Code Playgroud) 我正在使用Andrew Moore先生的方法(如何使用bcrypt在PHP中使用哈希密码?)哈希用户的密码.我做的是我有一个注册页面,它使用
$bcrypt = new Bcrypt(12);
$pass = $_POST['password']; //register password field
$hash= $bcrypt->hash($pass);
// then inserts $hash into database with users registered email (I've checked my mysql database and it indeed has an hashed item
Run Code Online (Sandbox Code Playgroud)
然后我有一个登录页面,包括电子邮件和密码字段.我的想法是电子邮件地址在我的数据库中是唯一的.因此,考虑到这一点,我创建了一个脚本,首先检查用户的电子邮件地址,然后如果有现有的,请用此验证哈希密码
$bcrypt = new Bcrypt(12);
$email = $_POST['email']; //from login email field
$pass_l = $_POST['password']; // from login password field
$hash_1= $bcrypt->hash($pass_1);
$chk_email= $dbh->prepare("SELECT password FROM table WHERE email = ?");
$chk_email -> execute(array($email));
while($row = $chk_email->fetch(PDO::FETCH_ASSOC)){
$chk_pass = $row['password']; //inside a …Run Code Online (Sandbox Code Playgroud) 我的缩略图上有[对象对象](背景图片是您可以点击上传照片的区域...我不知道如何加载类似于http://中示例的普通框www.dropzonejs.com/)

视图
<%= simple_form_for @project do |f| %>
<div class="dropzone dz-clickable dz-square" id="mydrop">
<div class="dz-default dz-message" data-dz-message=""></div>
<div id="bi_previews"></div>
<div class="fallback">
<%= f.file_field :beautiful_image %></div>
</div>
</div>
<% end %>
Run Code Online (Sandbox Code Playgroud)
CoffeeScript的
$(document).on 'ready page:load', ->
Dropzone.autoDiscover = false
$('div#mydrop').dropzone
url: '/projects'
previewsContainer: "#bi_previews"
headers: "X-CSRF-Token" : $('meta[name="csrf-token"]').attr('content')
paramName: "project[beautiful_image]"
init: ->
@on 'success', (file, json) ->
@on 'addedfile', (file) ->
@on 'drop', (file) ->
alert 'file'
return
return
Run Code Online (Sandbox Code Playgroud)
的routes.rb
Rails.application.routes.draw do
devise_for :users
resources :projects
Run Code Online (Sandbox Code Playgroud)
调节器 …
I don't get why I'm getting this error? I've copied exactly from the source code example. I'm able to get everything loaded, and then when I try to upload (by clicking start), I get this error.
But even if I'm getting this error, it still uploads to my database correctly. When I refresh my page, I have a show page that will display the uploaded images, and it's there. What's causing this issue?
Please help! I'm also using paperclip to …
我从我的ajax响应中得到一个[object object].
$.ajax({
type: "GET",
data: "id_1="+id_1+"&id_2="+id_2,
url:"ajax/url.php"
}).done(function(data){
var left= $(data).find("#left");
$("#left").html(left);
alert(left);
});
Run Code Online (Sandbox Code Playgroud)
在我的网址中,我只是简单的编码
if(isset($_GET["id_1"]) && isset($_GET['id_2'])){
$id_1 = $_GET["id_1"];
$id_2 = $_GET['id_2'];
$right= $dbh->prepare("SELECT COUNT(*) FROM table WHERE id_1 = ?");
$right->execute(array($id_1));
$left= $dbh->prepare("SELECT COUNT(*) FROM table WHERE id_1 = ? ");
$left->execute(array($id_2));
<div id='right'><?php echo $right->fetchColumn();?></div>
<div id='left'><?php echo $left->fetchColumn();?></div>
}
Run Code Online (Sandbox Code Playgroud)
当我完成所有操作后,它会回复[对象对象]
有谁知道它为什么这样做?
谢谢!
编辑:
我在.done中添加了一些编码(function())
我试图在li标签内获取文本值,但它有另一个我不想要的标签
例:
<ul>
<li><a class="close">x</a>text</li>
<li><a class="close">x</a>more text</li>
<li><a class="close">x</a>wohoooo more text</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我可以这样得到标签
$("ul li").text();
Run Code Online (Sandbox Code Playgroud)
但它也捕获了x a.如何删除标签?必须有一个我不熟悉的简单解决方案,
谢谢!
我是ruby的新手,我只是玩了一个演示应用程序.我已经包含了gem的act_as_votable,它的效果非常好,除了一个事实,我把它丢失了...... ajax.一直刷新页面有点乏味,所以我"试着"实现ajax,但没有运气:(.经过两个小时的资源后我觉得我什么也做不了.我需要帮助实现ajax on向下和向上投票.非常感谢.
这是我的代码:
entries_controller.rb
def upvote
@entry = Entry.find(params[:id])
unless current_user.voted_for? @entry
@entry.vote_total = @entry.vote_total + 1
@entry.save
@entry.upvote_by current_user
else
flash[:danger] = 'Sorry!! You had allready voted this entry!'
end
redirect_to :back
end
def downvote
@entry = Entry.find(params[:id])
unless current_user.voted_for? @entry
@entry.vote_total = @entry.vote_total + 1
@entry.save
@entry.downvote_by current_user
else
flash[:danger] = 'Sorry!! You had allready voted this entry!'
end
redirect_to :back
end
Run Code Online (Sandbox Code Playgroud)
_entry.html.erb(在条目文件夹中)
<aside class="vote-count bind-<%= entry.id %>">
<%= link_to like_entry_path(entry), :remote => true, method: :put, class: …Run Code Online (Sandbox Code Playgroud) 这些有什么区别?
我正在查看Typography Component API,并且有gutterBottom和paragraphprops记录了完全相同的内容,如果为true,则margin bottom将为0。这是指向Component API的链接:https : //material-ui.com/api/typography /
jquery ×4
ajax ×3
css ×2
php ×2
api ×1
bcrypt ×1
click ×1
css-float ×1
dropzone.js ×1
file-upload ×1
function ×1
hash ×1
html ×1
javascript ×1
json ×1
material-ui ×1
mouseevent ×1
mysql ×1
paperclip ×1
passwords ×1
reactjs ×1
ruby ×1
text ×1
xml ×1