小编B. *_*red的帖子

试图通过ajax获取Excel文档,遇到异步问题

我正在将JavaScript添加到SharePoint中,并且试图编写一个从库中获取Excel文档或其中数据的函数。我已经找到了解决方法,但是有问题的文件太大而无法返回。我已经考虑过手动设置ajax的大小限制,但是我没有找到任何方法来执行此操作,因此计划B是针对每一行发送查询

$("#button").click(function() {
			readFileRow(libraryUrl, "FileName.xlsx", "Sheet1", 1, "E", [])
			.done(function(cells) {
				console.log(xmlToJson(cells.documentElement));
			});
		});

/**
	 * Reads a file in SharePoint Library via ExcelRest and returns the document
	 *
	 * @params string libraryUrl
	 * @params string fileName
	 * @params string sheetName
	 * @params int rowNum
	 * @params string lastColumn
	 * @params string[][] finalResults
	 *
	 * @returns string[][]
	**/
	function readFileRow(libraryUrl, fileName, sheetName, rowNum, lastColumn, finalResults) {
		var fileUrl = libraryUrl + "/" + fileName + "/Model/Ranges('" + sheetName + "!A" …
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery

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

Ng Serve 返回“对象原型可能只是一个对象或空值:未定义类型错误:对象原型可能只是一个对象或空值:未定义”

我正在运行一个 MEAN Stack 站点,特别是我的前端使用 Angular。我最近更新了我的 package.json 文件以将 @angular/compiler-cli 从“^7.1.4”更新为“^8.2.4”。这是我的 package.json 文件的其余部分:

{
  "name": "monster-playbook",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "node server.js",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "postinstall": "ng build --output-path dist"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~7.1.0",
    "@angular/cli": "^7.1.4",
    "@angular/common": "~7.1.0",
    "@angular/compiler": "~7.1.0",
    "@angular/compiler-cli": "^8.2.4",
    "@angular/core": "~7.1.0",
    "@angular/forms": "~7.1.0",
    "@angular/http": "^7.1.1",
    "@angular/platform-browser": "~7.1.0",
    "@angular/platform-browser-dynamic": "~7.1.0",
    "@angular/router": "~7.1.0",
    "@ng-bootstrap/ng-bootstrap": "^4.0.3",
    "body-parser": "^1.18.3",
    "bootstrap": "^4.0.0-beta",
    "core-js": "^2.5.4",
    "express": "^4.16.4",
    "font-awesome": "^4.7.0",
    "mongodb": …
Run Code Online (Sandbox Code Playgroud)

node.js typescript angular

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

rails link_to使用get而不是post

我正在为一个类创建一个网站,我正在尝试使用名为"Users"的模型和一个名为"Relationships"的连接模型来实现一个朋友请求函数.我在用户#show页面上有一个按钮,它应该通过在Relationships控制器中使用create方法添加朋友.这是按钮的代码:

<%= link_to "Add as Friend", relationships_path(:friend_id => @user), method: :post %>
Run Code Online (Sandbox Code Playgroud)

但是,当我按下链接时,它会尝试访问索引方法.在查看控制台后,看起来链接正在发送GET请求,该请求路由到索引方法,而不是路由到create方法的POST请求.有人可以解释为什么会出现这种错误以及我如何解决它?

编辑:根据要求,这是我的路线中的内容:

Rails.application.routes.draw do
  resources :interests
  get 'interests/create'

  get 'interests/destroy'

  get 'home/index'

  get 'sessions/create'

  get 'sessions/destroy'

  resources :users
  resources :relationships
  resources :subscriptions

  # The priority is based upon order of creation: first created -> highest priority.
  # See how all your routes lay out with "rake routes".

  # You can have the root of your site routed with "root"
  # root 'welcome#index'
  root 'home#index'
  get "/auth/:provider/callback" => "sessions#create" …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails

3
推荐指数
2
解决办法
1290
查看次数

当我尝试使用 ngIf 运行方法时出现“ERROR TypeError: jit_nodeValue_6(...) is not a function”

我正在尝试创建一个页面,显示从我的数据库返回的所有值。它应该使用 ngFor 显示表行中的所有数据,并且当双击该行或单击该行左侧的编辑按钮时,它应该用一个充满输入字段的 ng-template 替换该行,方法是调用.ts 文件中的 editMovie() 函数。

问题是,当应该调用 editMovie() 时,我在控制台中收到此错误。

错误类型错误:jit_nodeValue_6(...) 不是函数

在 Object.eval [作为 handleEvent] (MovieComponent.html:52)

在 handleEvent (core.js:21673)

在 callWithDebugContext (core.js:22767)

在 Object.debugHandleEvent [as handleEvent] (core.js:22470)

在 dispatchEvent (core.js:19122)

在 core.js:19569

在 HTMLButtonElement。(平台浏览器.js:993)

在 ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421) 在 Object.onInvokeTask (core.js:16147) 在 ZoneDelegate.push../node_modules/zone .js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)

当双击该行(见 html 的第 20 行)和单击编辑按钮(见 html 的第 52 行)时,我都看到了这个错误。这让我相信问题出在 .ts 文件上。我还在 editMovie() 的第一行放了一个 console.log() 并且它没有显示,这让我相信在 editMovie 实际运行之前抛出了错误。

电影.component.html

<div class="row">
  <div class="col-md-2"></div>
  <div class="col-md-8">

    <div class="movies" *ngIf="moviesList">
      <table class="table">
        <thead class="h">
          <tr class="h">
            <th …
Run Code Online (Sandbox Code Playgroud)

html javascript css angular

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

标签 统计

angular ×2

javascript ×2

ajax ×1

css ×1

html ×1

jquery ×1

node.js ×1

ruby-on-rails ×1

typescript ×1