我想用ember.js向服务器发送POST(而不是GET)请求.我不知道我在"哪个功能在这里"需要哪个功能,但我想将它发送到服务器以获取登录请求.
App.LoginController = Ember.ObjectController.extend({
actions: {
userLogin: function(user) {
// which function here?
?? ("http://siteurl/api/authentication/login/&username=" + user.username + "&password=" + user.password + "");
this.transitionTo('cat');
},
cancelLogin: function() {
this.transitionTo('menu');
}
}
});
App.UserFormComponent = Ember.Component.extend({
actions: {
submit: function() {
this.sendAction('submit', {
username: this.get('username'),
password: this.get('password')
});
},
cancel: function() {
this.sendAction('cancel');
}
}
});
Run Code Online (Sandbox Code Playgroud)
在这里模板代码
<script type="text/x-handlebars" data-template-name="login">
<header class="bar bar-nav">
<h1 class="title">inloggen</h1>
{{#link-to 'menu' class="icon icon icon-bars pull-right"}}{{/link-to}}
</header>
<!-- SHOW LOADER -->
<div …Run Code Online (Sandbox Code Playgroud) 我在简单的 Alpine 表单部分中选择的选项有问题。我的选择框从 api 获取其值。x-model 在获取之前设置。选择框有时会显示正确的选定值,有时则不会。即使我在获取后设置值,也不会(始终)选择所选选项。如何确保始终设置正确的选定值?
注意:选择框 2 的值取决于第一个选择框设置的值。但如果两者都设置,则它们必须都显示在 valueA 和 valueB 处给出的正确选定值。
这是我的功能
<script>
function alpineSelectFunction() {
return {
valueA: '100',
arrayA: [],
valueB: '101',
arrayB: [],
isLoading: false,
apiUrl: "apiurl",
fetchArrayA() {
fetchUrl = this.apiUrl + `arrayA.json`;
this.isLoading = true;
fetch(fetchUrl)
.then(res => res.json())
.then(data => this.arrayA = data.data);
this.isLoading = false;
},
fetchArrayB() {
fetchUrl = this.apiUrl + `arrayB.json?id=${this.valueA}`;
this.isLoading = true;
fetch(fetchUrl)
.then(res => res.json())
.then(data => this.arrayB = data.data);
this.isLoading = false;
},
init() { …Run Code Online (Sandbox Code Playgroud) 我想用jquery查找和替换文本.我想将"SKU:"更改为"art nu".
<span itemprop="productID" class="sku_wrapper">
SKU:
<span class="sku">
5-144
</span>.
</span>
Run Code Online (Sandbox Code Playgroud)
我试过了:
$(".product_meta>.sku_wrapper:contains('SKU:')" ).text('art nu.');
Run Code Online (Sandbox Code Playgroud)
但这删除了孩子跨度sku.
希望有人有解决方案......
我试图删除除所有html标签p,a和img标签.现在我有:
content.replace(/(<([^>]+)>)/ig,"");
Run Code Online (Sandbox Code Playgroud)
但这会删除所有HTML标记.
这是api内容的示例:
<table id="content_LETTER.BLOCK9" border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#F7EBF5">
<tbody><tr><td class="ArticlePadding" colspan="1" rowspan="1" align="left" valign="top"><div>what is the opposite of...[] rest of text
Run Code Online (Sandbox Code Playgroud)