将我的变量信息发送到网址(Sending my variable information to a url)
我使用以下代码将信息添加到我的列表中,它工作正常。 最重要的是,我想将下面的2变量(listDescription和payment)发送到URL,如下所示:
http://mywebsite.com/public/user/spent/?amount= listDescription &account = payment
我正在尝试使用ajax并使用以下代码发送信息,但它不起作用,我得不到任何响应警报。 请问我能得到一些帮助。 谢谢。
$(document).ready( function() { var listDescription; var payment; //prepending - working fine $('#add_list').click( function() { listDescription = $('#list_description').val(); payment = $('#payment').val(); $('.expense_list').prepend('<div>' + "\u00A3 " + listDescription + "\t\t\t" + payment + "\t" + '</div>'); //This is not working $.ajax({ url: "htttp://mywebsite.com/public/user/spent/", data: { amount: listDescription, account: payment }, type: "GET", async:true, cache:false, success: function (data) { alert("success"); }, error: function (xhr, status, error) { alert("error"); } }); $('#list_form')[0].reset(); return false; }); });
I am using the following code to prepend information into my list and it is working fine. On top of that, I want to send the 2 variable below (listDescription and payment) to a url too as follows :
http://mywebsite.com/public/user/spent/?amount=listDescription&account=payment
I am trying to use ajax and send the information over with the following code but it is not working and I get no response alerts either way. Can I get some help on this please. Thanks.
$(document).ready( function() { var listDescription; var payment; //prepending - working fine $('#add_list').click( function() { listDescription = $('#list_description').val(); payment = $('#payment').val(); $('.expense_list').prepend('<div>' + "\u00A3 " + listDescription + "\t\t\t" + payment + "\t" + '</div>'); //This is not working $.ajax({ url: "htttp://mywebsite.com/public/user/spent/", data: { amount: listDescription, account: payment }, type: "GET", async:true, cache:false, success: function (data) { alert("success"); }, error: function (xhr, status, error) { alert("error"); } }); $('#list_form')[0].reset(); return false; }); });
原文:https://stackoverflow.com/questions/22733255
更新时间:2023-11-19 07:11
最满意答案
加
style="text-align:right"
到那个twitter div
add
style="text-align:right"
to that twitter div
相关问答
更多-
垂直对齐社交按钮(Vertical Align Social Buttons)[2021-11-06]
添加以下CSS代码: #social-buttons > span { vertical-align: middle; } #social-buttons > span > * { vertical-align: middle !important; } 我使用!important来强制覆盖内联CSS。 Add following CSS code: #social-buttons > span { vertical-al ...查看代码,您可能需要为每个代码添加单独的类,因为它们都在不同的元素中。 有一些方法,绝对定位,显示:内联,但我建议浮动 添加一个ul元素和每个“共享按钮”作为该ul的li子元素然后你的CSS可以看起来像这样 ul.shareLinks { overflow: auto; } ul.shareLinks li { list-style: none; floa ...他们在扩展页面中工作。 您必须明确指定公共URL,并且必须修改facebook / twitter以明确包含协议。 //platform.twitter.com到https://platform.twitter.com popup.html Follow @twitterdiv #logincont设置为float:left并且有一个巨大的margin-left ,这是不必要的。 它应该是float: right没有边距,就像这样 #logincont { width:330px; float:right; } 更新 :如果我理解正确,您希望社交媒体图标在右侧对齐,但不能远离站点内容。 尝试这个 : #logincont { width: 940px; text-align: right; margin: 0 auto; } wi ...加 style="text-align:right" 到那个twitter div add style="text-align:right" to that twitter div.socialMediaIcon li { display: inline-block; } ul { list-style: none; } .socialMediaIcon li a { display: inline-block; } .socialMediaIcon { text-align: center; }