以下是我的参数
$('#back-button').click(function(){
$('#formular-content').load('/eshop/formular/1.php',function(){
$( "#slider-range" ).slider({
range: true,
min: 0,
max: 500,
values: [ 75, 300 ],
slide: function( event, ui ) {
$( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
}
});
//initialise anything here as in .slider() to the `element` which is loaded through ajax.
});
});
和post方法函数包含以下代码
var comment: [String:AnyObject] = [:]
comment = [
"txtUsername": (txtUsername?.text)! as AnyObject,
"txtPassword": (txtPassword?.text)! as AnyObject
]
这里的目标c我的webservice工作成功,但在使用此代码时,它总是给出响应“false”......这段代码中是否有任何错误。
答案 0 :(得分:0)
很多事情都可能出错。如果我要调试,我会检查一些事情:
UIImagePNGRepresentation(...)
而不是UIImageJPEGRepresentation
。multipartFormData.append(imageData, withName: "file", fileName: "file.png", mimeType: "image/png")
更改为multipartFormData.append(imageData, withName: "file", fileName: "file.jpg", mimeType: "image/jpeg")
。UIImageJPEGRepresentation(image, 1)
更改为UIImageJPEGRepresentation(image, 0.5)
。它可能会失败,因为图像太大,因此应用更高的压缩可能会发现问题。