[英]how can i pass my webform value in webapi controller as a model class using jquery ajax
[英]How can I pass my dropdown style value on to my php file via jQuery/ajax?
这是我的下拉菜单的标记:
<select id="themes">
<option selected="selected">Themes:</option>
<option value="default">Default</option>
<option value="red">Red</option>
<option value="bw">Black and White</option>
<option value="invert">Invert</option>
</select>
我现在正在使用的jQuery:
$("#themes").change(function() {
$.ajax({
url: "css/style.php",
method: "GET",
data: {"theme="+$(this).val(); }
})
});
这给了我一个控制台错误“ Uncaught SyntaxError:意外的标记+”。 我要做的就是将$ _GET ['theme']传递给我的style.php,这样我就可以使用条件处理它。 有什么建议吗?
将数据创建为对象,代码中存在语法问题
$("#themes").change(function () {
$.ajax({
url: "css/style.php",
method: "GET",
data: {
theme: $(this).val()
}
})
});
像这样做.............
$("#themes").change(function(){
var theme = $(this).val();
$.ajax({
url: "css/style.php",
method: "GET",
data: {theme : theme },
success: function(data) {
}//end of success
});
});
我一直使用这种技术,然后使用
$theme = $_GET['theme'];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.