FineUploader - params dont get added to deleteFile - fine-uploader

I am using the param option in the deleteFile settings to send a temporary ID that I use throughout the page
deleteFile: {
enabled: true,
forceConfirm: false,
method: 'POST',
endpoint: 'myendpoint',
params: {tempID: 'MYFIXEDID'}
},
No post value for tempID is passed in the request. The same syntax works ok for the request settings.

This is confirmed as a bug in version 5.3.2. Request has been opened on the issue tracker.
I have left this question and answer here in case others are having the same issue.

Related

React js AJAX sends sometimes GET instead of POST and getting 304 strange

I've got a problem and I have no idea why it appears. The circumstances of its appearance are very strange for me...
I've got a POST REST service /login. It expects json {"email":email,"password":password}. I am using ajax and everything works correctly... except for the case when email (is in real format) contains '#' sign and some letters before and after( I know it is strange but only in this case such error appears). When I pass email i.e "mum#mum.com" then few things are happening:
I see that browser sends GET request instead of POST and obtains 304 http status
In the browser console I see infomation "The development server has disconnected. Refresh the page if necessary" and page refreshes automatically
The above things happen only when email is in format I described above.When I pass "aaa" or "aaa#" as email everything works correctly(browser sends POST request and I don't get error in console).
I honestly have no idea why this happens... would be extremely grateful for your help and I will answer all your questions concerning this.
PS.
When I use REST web service tool in IntellJ everything always works fine.
handleLogin() {
const input = {
email: this.state.email,
password: this.state.password
};
$.ajax({
url: CONST.USER_SERVICE + "/login",
type: "POST",
data: JSON.stringify(input),
contentType: "jsonp"
})
.fail(function () {
alert("Wrong data");
})
.always(function (arg1, arg2, arg3) {
if (arg3.status === 200) {
alert("ok!");
}
}.bind(this));
}
Try making the ajax request like data: input without stringify. Ajax expects an object.

Fine Uploader Params Not Sent

I'm trying to use Fine Uploader 5.15.0, set up with multiple file fields & uploader instances (multiple: false is set on each) which all display and select files correctly. They are posting to a custom endpoint that is returning any parameters to me. Uploads are set to happen as soon as the file is selected, and file and QQ parameters are sent okay.
My problem is when I attempt to send additional data to the server along with the upload.
I have tried including my additional parameters in the endpoint of the request option, and as a params node added to the options variously as follows:
uploaders[1] = new qq.FineUploader({
element: document.getElementById("uploader-1"),
multiple: false,
request: {
endpoint: "default.cfm",
paramsInBody: false,
params: {
act: "action/processFile",
uid: 4747
}
}
})
Calls without any parameters available in either form or URL scopes.
Removing the params section and attempting to pass them via endpoint:
request: { endpoint: "default.cfm?act=action/processFile" }
Works fine, but obviously no additional parameters.
request: { endpoint: "default.cfm?act=action/processFile&uid=4747" }
Calls without any URL parameters.
request: { endpoint: "default.cfm?act=action/processFile&uid=4747" }
Calls with "act" available, but all others have their ampersand stripped out, so the parameter name becomes "amp;uid"
According to https://blog.fineuploader.com/include-params-in-the-request-body-or-the-query-string-479ac01cbc63 and other questions on here the first one should work. For the others obviously FineUploader is doing some additional processing on endpoint that is wiping out my parameters.
I'm missing something essential, can anyone educate me?
Thanks!

Ext.Ajax Cross-Domain post request

I'm testing ExtJS v.5.1.0.107 and I my goal is that to perform a post ajax request on a different server. I've found some similar discussions but nothing seems to work for my scenario.
Here's request code:
Ext.Ajax.request({
url: 'http://192.168.1.60/test.php',
method: 'POST',
cors: true,
useDefaultXhrHeader : false,
params : {
myPar1 : myPar1Value
},
success: function () {
alert('success');
},
failure: function () {
alert('failure');
}
});
Here's error message:
XMLHttpRequest cannot load http://192.168.1.60/test.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.1.50:22800' is therefore not allowed access.
Is there something wrong?
Hope someone can help me.
Thanks to all.
Make sure your files are reachable from the server...
If the server is well configured, try add a response header for
Access-Control-Allow-Origin: *
This command will allow cross-domain through Ajax operations. Then, the requested file (test.php for instance on the targeted server) should contain in the first lines :
<?php header('Access-Control-Allow-Origin: *'); ?>
Then, you should change parameter for Apache server hosting test.php file. In the .htacess file :
header set Access-Control-Allow-Origin "http://192.168.1.60/"
Hope this helps !

Cross Domain Ajax call EasyXDM

I'm trying to make a cross domain Ajax call using EasyXDM, because this gives support for IE apparently.
I have the following code, It says in the documentation that you need to call the cors file on the other domain, but it mentions you can skip that part, I want to skip it because I can't upload the cors file there and they have allowed my domain in the headers anyway. How do I write the code without declaring the cors file?
var xhr = new easyXDM.Rpc();
var response;
function getState(){
xhr.request({
url: "http://somedomain.com/misc/promo_getstate.php",
method: "POST",
data: {
email: 'sofia#hotmail.com',
source: '1304_Spring_dly',
country: 'DE',
}
}, function(response){
alert(response.status);
alert(response.data);
});
I know it's a little late, but you might find this link helpful (it's a blog post specifically about using easyxdm to do cross-domain AJAX):
http://easyxdm.net/wp/2010/03/17/cross-domain-ajax/

Content loading with jsonp

I am a beginner at sencha touch2. i am trying to create a some app which contains a blog view. the code of the blog is given below. when i launch the app, the content fails to load, giving these errors. i am using wamp for localhost.
XMLHttpRequest cannot load " http://secureclick-media-maynemyltf.netdna-ssl.com/Extensions/rjs/c2.js". Origin< http://localhost> is not allowed by Access-Control-Allow-Origin.
XMLHttpRequest cannot load " http://api.yontoo.com/GetClientData.ashx?key=null&id=47a8564d-d089-4195-9564-72f107ea1c56&loc=http%3A//localhost/GS/&apps=bestvideodownloader,ezLooker,pagerage,buzzdock,toprelatedtopics,twittube". Origin <http://localhost> is not allowed by Access-Control-Allow-Origin.
Ext.define('GS.view.blog',
{
extend:'Ext.navigation.View',
xtype: 'blogpanel',
config:{
title: 'Blog',
iconCls: 'star',
items:
{
xtype:'list',
itemTpl:'{title}',
store:
{
autoLoad: true,
fields:['title','author','content'],
proxy:
{
type:'jsonp',
url: 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://feeds.feedburner.com/SenchaBlog',
reader:
{
type:'json',
rootProperty:'responseData.feed.entries',
}
}
}
}
}
});
You're not calling a JSONP service but a JSON one. You can detect it by calling your URL from your browser and see the content isn't starting by a method call.
So you're not bypassing Cross-Domain protections.
You can't just tell the server you want it to answer in JSONP : it must be ready to make such an answer.
And your browser won't let you access from another domain a server answering in json and not having set a header specifying he accepts this cross-domain request. Read this.
EDIT :
You may call this service using JSONP : you just have to specify a callback at the end of the URL.
In addition to this response format, the protocol also supports a
classic JSON-P style callback which is triggered by specifying a
callback argument, which directs the API to deliver the JSON object as
an argument to the specified callback.
Example from the documentation :
'https://ajax.googleapis.com/ajax/services/feed/find?v=1.0&q=Official%20Google%20Blogs&callback=processResults'

Resources