我的页面上有多个表单.当我单击表单提交按钮时,我想通过ajax仅发送该表单的表单值.这就是我所拥有的.第一种形式作为其应有的,第二种形式实际提交形式.如何单独定位每个表单.我觉得我应该在某处使用.find().
<form id="form1" method="post">
<input type="text" id="name1" name="value" value="">
<input type="submit" id="update_form" value="Save Changes">
</form>
<form id="form2" method="post">
<input type="text" id="name2" name="value" value="">
<input type="submit" id="update_form" value="Save Changes">
</form>
<script>
// this is the id of the submit button
$("#update_form").click(function() {
$.ajax({
type: "POST",
url: "approve_test.php",
data: $(this.form).serialize(), // serializes the form's elements.
success: function(data)
{
alert(data); // show response from the php script.
}
});
return false; // avoid to execute the actual submit of the form.
});
</script>
Run Code Online (Sandbox Code Playgroud) 我使用它来选择一个tr,当点击更改tr的颜色.
$("tr").click(function(){
$(this).addClass("selected").siblings().removeClass("selected");
});
Run Code Online (Sandbox Code Playgroud)
见小提琴http://jsfiddle.net/4sn38/3/
但是当我在父div上使用nth-child类来设置tr背景时,我的addClass没有被添加.如何与我的jquery addClass函数一起使用nth-child类?
这就是我想要做的
见小提琴http://jsfiddle.net/4sn38/
这没用
$(".list tr:nth-child(1)").addClass("selected").siblings().removeClass("selected");
Run Code Online (Sandbox Code Playgroud)
这会改变颜色,但是当单击另一个时我无法删除它
$(this).css('background','blue');
Run Code Online (Sandbox Code Playgroud)
我有什么想法我做错了吗?
我有一个从Web服务中提取的对象列表.当我更新我的UITableView时,我再次从Web服务检索对象,并将它们相互比较以确保相等.然后我删除那些不存在的,并插入新对象,然后更新我的UITableView.如何测试新对象是否等于旧对象?为了清晰起见,我创建了一个测试..
requestA应该等于requestC,但是失败了.
这可能不用查看每个属性值,因为对象有很多值吗?
我最初只是在比较ID,但这不起作用,因为有时其他属性值会发生变化且ID保持不变.
Request *requestA = [[Request alloc] init];
Request *requestB = [[Request alloc] init];
Request *requestC = [[Request alloc] init];
requestA.requestID = @"1";
requestA.productName = @"Clutch";
requestB.requestID = @"2";
requestB.productName = @"Wiper";
requestC.requestID = @"1";
requestC.productName = @"Clutch";
if (requestA == requestB)
NSLog(@"A == B");
if (requestA == requestC)
NSLog(@"A == C");
if ([requestA isEqual:requestB])
NSLog(@"A isEqual B");
if ([requestA isEqual:requestC])
NSLog(@"A isEqual C");
// Look at the pointers:
NSLog(@"%p", requestA);
NSLog(@"%p", requestB);
NSLog(@"%p", requestC);
Run Code Online (Sandbox Code Playgroud) 我有这样的cURL请求
$ch = curl_init();
$data = 'filter=year(StartTime)' . urlencode(' eq 2013 and ') .'month(StartTime)'. urlencode(' eq 06') ;
curl_setopt($ch, CURLOPT_URL, "http://url.com/id()/events?$".$data);
$headers = array(
'Accept: application/json',
'Content-type: application/json',
'X-ApiKey : XXXXXXXXXX'
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, false);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
</head>
<body>
<br><br>
<?php
echo "the name". $result['Name'];
?>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这就是它打印的内容.
HTTP/1.1 200 OK Cache-Control: no-cache Pragma: no-cache Content-Length: 218 Content-Type: application/json; charset=utf-8 Expires: …
Run Code Online (Sandbox Code Playgroud)