GVKun编程网logo

jquery – $(“#MyForm”).submit(function(){在IE8中不起作用但FireFox 8不起作用?(firefox html document)

18

在本文中,我们将给您介绍关于jquery–$(“#MyForm”).submit(function(){在IE8中不起作用但FireFox8不起作用?的详细内容,并且为您解答firefoxhtmldo

在本文中,我们将给您介绍关于jquery – $(“#MyForm”).submit(function(){在IE8中不起作用但FireFox 8不起作用?的详细内容,并且为您解答firefox html document的相关问题,此外,我们还将为您提供关于$ .ajax调用在IE8中工作正常,在Firefox和Chrome浏览器中不起作用、$.ajax调用在IE8中工作正常,在Firefox和Chrome浏览器中不起作用、Angular 2将表单分配给不起作用的变量#f =“form”(submit)=“onSubmit(f.value)”、CSS @ font-face在IE8中不起作用的知识。

本文目录一览:

jquery – $(“#MyForm”).submit(function(){在IE8中不起作用但FireFox 8不起作用?(firefox html document)

jquery – $(“#MyForm”).submit(function(){在IE8中不起作用但FireFox 8不起作用?(firefox html document)

$(document).ready(function () {
    $("#MyForm").submit(function () {
        alert("Hello");
        return true;
    });
});

嗨,我上面有一个非常简单的代码,当我在IE8中提交表单时没有任何反应,但它在FireFox 8中工作正常.

我正在使用jQuery 1.5.1.这是旧版jQuery的问题吗?

解决方法

我之前在IE8和IE7中看过这个.解决方法:

$("#MyForm").submit(function () {
    alert("Hello");
    return true;
});

// change input type to whatever submits the form
$("#MyForm input[type='submit']").click(function(e) {
    e.preventDefault();
    $(this).closest("form").submit();
});

$ .ajax调用在IE8中工作正常,在Firefox和Chrome浏览器中不起作用

$ .ajax调用在IE8中工作正常,在Firefox和Chrome浏览器中不起作用

这是我的代码

$.ajax({    type: "GET",     url: ''http://devserver:7995/stdpart/services/GetAllPartsWithFilter'',    dataType: ''json'',    data: jsonPartsData,    success: fnGetPartsData,     error: PartsLoadError  });

这段代码在IE8中工作正常,但是在Firefox和Chrome浏览器中却失败了。当我检查XHR对象时,它表示状态码为0。我检查了所有其他问题,没有一个问题可以帮助我识别问题。

让我知道,如果我在这段代码中做错了什么。如果$ .ajax有一些兼容性问题,请提出与其等效的建议。

更新: 我们在http://www.xml.com/pub/a/2005/12/21/json-dynamic-script-
tag.html找到了一种解决方案

它使用了 动态脚本 的概念。我们在应用程序中做了同样的事情,那么现在似乎所有事情都在起作用。尚未充分分析。

答案1

小编典典

这是因为有相同来源政策。您不能使用ajax调用外部站点。如果确实要使用,则必须使用JSONP。或者,您可以使用服务器端代理。意味着,请在服务器端调用外部站点,然后对该Web服务进行Ajax调用。


更新:

在您的网站和webmethod中创建webserveice,然后输入以下代码

string proxyURL = "http://devserver:7995/stdpart/services/GetAllPartsWithFilter";HttpWebRequest request = (HttpWebRequest)WebRequest.Create(proxyURL);request.Method = "GET";HttpWebResponse response = (HttpWebResponse)request.GetResponse();if (response.StatusCode.ToString().ToLower() == "ok"){    Stream content = response.GetResponseStream();    StreamReader contentReader = new StreamReader(content);             return contentReader.ReadToEnd();}return string.Empty;

然后使用您的代码访问本地服务。

有关更多信息,请参考此链接

$.ajax调用在IE8中工作正常,在Firefox和Chrome浏览器中不起作用

$.ajax调用在IE8中工作正常,在Firefox和Chrome浏览器中不起作用

这是我的代码

$.ajax(
{
    type: "GET",url: 'http://devserver:7995/stdpart/services/GetAllPartsWithFilter',dataType: 'json',data: jsonPartsData,success: fnGetPartsData,error: PartsLoadError  
});

这是在IE8中运行良好的代码,但在Firefox和Chrome浏览器中失败了.当我检查XHR对象时,它说的是状态代码为0.我检查了所有其他问题,没有一个能帮我识别问题.

让我知道,如果我在这段代码中做错了什么.如果$.ajax有一些兼容性问题,那么请建议一些与之相当的东西.

更新:
我们找到了一个解决方案
http://www.xml.com/pub/a/2005/12/21/json-dynamic-script-tag.html

它使用Dynamic Sc​​ripting的概念.我们在我们的应用程序中做了同样的事情,然后现在每件事似乎都在工作.然而要充分分析.

解决方法

这是因为 Same origin policy.你不能使用ajax来调用外部站点.如果你真的想使用,你必须使用 JSONP.或者你可以使用服务器端代理.意味着,在服务器端调用外部站点并对该Web服务执行ajax调用.

更新:

在您的网站和web网络方法中创建webserve,并提供以下代码

string proxyURL = "http://devserver:7995/stdpart/services/GetAllPartsWithFilter";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(proxyURL);
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

if (response.StatusCode.ToString().ToLower() == "ok")
{
    Stream content = response.GetResponseStream();
    StreamReader contentReader = new StreamReader(content);         
    return contentReader.ReadToEnd();
}
return string.Empty;

然后使用您的代码访问本地服务.

for more information please refer this link

Angular 2将表单分配给不起作用的变量#f =“form”(submit)=“onSubmit(f.value)”

Angular 2将表单分配给不起作用的变量#f =“form”(submit)=“onSubmit(f.value)”

我只是通过流星角2教程.在 step 4中,使用散列f等于形式的角度2形式绑定用于将形式绑定到变量f,然后用于绑定onSubmit函数.两者都不适合我. Angular 2 API是否已更改?

不工作的HTML:

<form #f="form" (submit)="addParty(f.value)">
  <div>{{f.value}}</div>
</form>

来自示例的parties-form.html的原始HTML代码:

<form [ng-form-model]="partiesForm" #f="form" (submit)="addParty(f.value)">
  <label>Name</label>
  <input type="text" ng-control="name">
  <label>Description</label>
  <input type="text" ng-control="description">
  <label>Location</label>
  <input type="text" ng-control="location">
  <button>Add</button>
  <div>{{f}}</div>
  <div>{{f.value}}</div>
</form>

和JS组件party-form.ts:

/// <reference path="../../typings/angular2-meteor.d.ts" />

import {Component,View} from 'angular2/angular2';

import {FORM_DIRECTIVES,FormBuilder,Control,ControlGroup,Validators} from 'angular2/angular2';

import {Parties} from 'collections/parties';

@Component({
    selector: 'parties-form'
})
@View({
    templateUrl: 'client/parties-form/parties-form.html',directives: [FORM_DIRECTIVES]
})
export class PartiesForm {
    partiesForm: ControlGroup;

    constructor() {
        var fb = new FormBuilder();
        this.partiesForm = fb.group({
            name: ['',Validators.required],description: [''],location: ['',Validators.required]
        });
        // Test
        console.log(this.partiesForm.value);
    }

    addParty(party) {
        console.log("assparty",party);
        return true;
        if (this.partiesForm.valid) {
            Parties.insert({
                name: party.name,description: party.description,location: party.location
            });

            (<Control>this.partiesForm.controls['name']).updateValue('');
            (<Control>this.partiesForm.controls['description']).updateValue('');
            (<Control>this.partiesForm.controls['location']).updateValue('');
        }
    }

}
console.log("PartiesForm loaded");

我复制了流星角2样本,看那里的确切代码.像ng-book这样的其他样本也使用它作为onSubmit功能

#f="form" (submit)="onSubmit(f.value)"

解决方法

问题是一个缓存问题.通过教程,第一个版本是缓存.不确定,但我认为meteor应该自动执行缓存清理,但是我需要手动删除缓存以使其正常运行.

CSS @ font-face在IE8中不起作用

CSS @ font-face在IE8中不起作用

我尝试阅读有关如何处理IE中自定义字体的多篇文章,但是它们似乎对我没有用。我尝试将字体转换为EOT,但这似乎也不起作用。我不确定自己在做什么错,所以我将发布我的代码

@font-face {  font-family: "Klavika Regular";    src: url(''../fonts/klavika.eot'');    src: local(''☺''), url(''../fonts/klavika.woff'') format(''woff''), url(''../fonts/klavika.ttf'') format(''truetype''), url(''../fonts/klavika.svg'') format(''svg'');  font-weight: normal;  font-style: normal;}

答案1

小编典典

这在ie8 / 9中有效

@font-face {    font-family: ''AftaserifRegular'';    src: url(''AftaSerifThin-Regular-webfont.eot'');    src: url(''AftaSerifThin-Regular-webfont.eot?#iefix'') format(''embedded-opentype''),         url(''AftaSerifThin-Regular-webfont.woff'') format(''woff''),         url(''AftaSerifThin-Regular-webfont.ttf'') format(''truetype''),         url(''AftaSerifThin-Regular-webfont.svg#AftaserifRegular'') format(''svg'');    font-weight: normal;    font-style: normal;}

我们今天的关于jquery – $(“#MyForm”).submit(function(){在IE8中不起作用但FireFox 8不起作用?firefox html document的分享就到这里,谢谢您的阅读,如果想了解更多关于$ .ajax调用在IE8中工作正常,在Firefox和Chrome浏览器中不起作用、$.ajax调用在IE8中工作正常,在Firefox和Chrome浏览器中不起作用、Angular 2将表单分配给不起作用的变量#f =“form”(submit)=“onSubmit(f.value)”、CSS @ font-face在IE8中不起作用的相关信息,可以在本站进行搜索。

本文标签: