小编Dom*_*ell的帖子

IE不会触发jQuery Ajax的成功

我正在编写一个脚本来使用jQuery加载一些异步图像.

这是加载图像的函数的代码片段 -

try{
    for(img in imgsArray){
        $.ajax({    
            async: false,
            type: "get",
            url:imgsArray[img],
            success:function(imgFile){
                alert("success");
                //do something useful
            },
            error:function(XMLHttpRequest,status,error){
                //do nothing
            }
        });//ajax
    } 
}
catch(e){
    //oops
}
Run Code Online (Sandbox Code Playgroud)

我已经在Firefox,Webkit(Safari,Chrome)中对此进行了测试,但它确实有效.

图像位于服务器上的文件夹中,我正在使用jQuery 1.3.

有任何想法吗?

ajax jquery internet-explorer

14
推荐指数
3
解决办法
5万
查看次数

在Java Swing中显示图像

public class MinesweeperMenu extends MinesweeperPanel{

private JPanel picture = new JPanel();
private JButton play = new JButton("Play");
private JButton highScores = new JButton("High Score and \nStatistics");
private JButton changeMap = new JButton("Create Custom \nor Change Map");
private JButton difficulty = new JButton("Custom or\nChange Difficulty");
private JButton user = new JButton("Change User");
Image img;

public MinesweeperMenu()
{
    // Set Layout for the menu
    LayoutManager menuLayout = new BoxLayout(menu, BoxLayout.Y_AXIS);
    menu.setLayout(menuLayout);

    // Set Layout for the window
    LayoutManager windowLayout = new BorderLayout(); …
Run Code Online (Sandbox Code Playgroud)

java icons swing imageicon

12
推荐指数
2
解决办法
7万
查看次数

Web Api用户标识返回null

我成功以用户身份登录,然后用户可以访问该站点的[授权]部分.用户名甚至会显示在网站的右上角,因为它们已成功通过身份验证.但是,当我尝试在我的帖子中获取用户身份以创建新事件时,该用户为空.

这是我的登录服务:

login.service('loginService', function ($http, $q) {
    var deferred = $q.defer();

    this.signin = function (user) {
        var config = {
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        }

        $http.post('Token', 'grant_type=password&username='+user.UserName+'&password='+user.Password, config)
            .success(function (data) {
                window.location = "/dashboard";
            }).error(function (error) {
                deferred.reject(error);
            });

        return deferred.promise;
    }
});
Run Code Online (Sandbox Code Playgroud)

这是我发布新活动的帖子

[Route("post")]
public HttpResponseMessage PostEvent(EventEditModel ev)
{
    if (!ModelState.IsValid)
    {
        return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "{ }");
    }
    try
    {
        Event DBEvent;
        if (ev.EventId > 0)
        {
            DBEvent = db.Events.Find(ev.EventId);
            DBEvent.ModifiedBy = Guid.Parse(User.Identity.GetUserId());
            DBEvent.ModifiedOn = DateTime.Now;
        }
        else
        { …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-web-api angularjs

5
推荐指数
1
解决办法
2727
查看次数

在c中编译链表的错误

我在我的Mac上用NetBeans完成了我的整个项目,它运行正常.然后我把它放到终端,在学校的ssh服务器上提交它,它给了我一堆编译错误.netbeans是用c ++编译的吗?我是新来的,所以任何帮助肯定是值得赞赏的.这是代码.

/* 
 * File:   LinkedList.c
 * Author: dpiganell
 *
 * Created on October 17, 2011, 2:31 PM
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct element{
    int i;
    struct element *next;
};

void insert(struct element**, struct element*);
void purge (struct element*, struct element*);
void printList(struct element*);
void printListBackwards(struct element*);

struct element *h;

int main() 
{
    // HEAD
    h = (element *) malloc(sizeof(element));
    h = NULL;

    // NEW VALUE
    struct element *n = NULL;

    // POINTER TO THE POINTER OF …
Run Code Online (Sandbox Code Playgroud)

c

2
推荐指数
1
解决办法
810
查看次数

角度URL"trustAsResourceUrl"无法正常工作

我正在使用angular-file-upload.js并上传图片.上传成功后,它会返回托管图像的URL,该图像在Azure上作为blob托管.上传成功,并且URL正确返回,但是当我在"images"堆栈上推送此URL以在浏览器中查看此图像时,它将无法正常工作.例如,我得到的URL如下所示:

"https://searlesmedia.blob.core.windows.net/event-images/4_slide-archive.jpg"
Run Code Online (Sandbox Code Playgroud)

Controller.js

uploader.onSuccessItem = function (fileItem, response, status, headers) {
    console.info('onSuccessItem', fileItem, response, status, headers);
    $scope.uploadcomplete = "Upload Successful";
    var url = $sce.trustAsResourceUrl(response);
    $scope.images.push(url);
};
Run Code Online (Sandbox Code Playgroud)

HTML

<div class="row" data-ng-repeat="image in images">
    <img ng-src="{{image}}" class="img-responsive" />
</div>
Run Code Online (Sandbox Code Playgroud)

javascript angularjs

2
推荐指数
1
解决办法
1万
查看次数

单击更改JButton的颜色将不起作用

public class LevelEditorButton extends JButton
{
/**
 * 
 */
private static final long serialVersionUID = 1L;
private int i;

public int getState()   {return i;}
public void increaseState()
{
    if(i == 2)
        i = 0;
    else
        i++;
    changeState();
}

public LevelEditorButton()
{
    i = 0;
    changeState();
    this.setOpaque(true);
}
public void changeState()
{
    if(i == 0)
        this.setBackground(Color.GREEN);
    else if(i == 1)
        this.setBackground(Color.RED);
    else 
        this.setBackground(Color.BLACK);
    this.setOpaque(true);
}
}

public class ChangeColorButtonListener extends LevelEditorButton implements ActionListener
{
     @Override
     public void actionPerformed(ActionEvent ae) 
    {
    this.increaseState(); …
Run Code Online (Sandbox Code Playgroud)

java swing

1
推荐指数
1
解决办法
144
查看次数

ostream.h:没有这样的文件或目录

我正在尝试使用更新的编译器和更新的工具更新旧项目(vxWorks的新版本,但它应该无关紧要).在代码中它说:

#include <ostream.h>
Run Code Online (Sandbox Code Playgroud)

然而,我收到了大量的错误,其中大部分来自:

ostream.h: No such file or directory
Run Code Online (Sandbox Code Playgroud)

我查了一下错误,很多解决方案都说将其更改为:

#include "ostream"
Run Code Online (Sandbox Code Playgroud)

这是有效的,但这是遗留代码,我宁愿不去改变所有这些.有没有办法可以在不更改代码的情况下更改这些内容?

c c++ legacy include ostream

1
推荐指数
1
解决办法
2160
查看次数