{"action":"created","issue":{"url":"https://api.github.com/repos/LPology/Simple-Ajax-Uploader/issues/125","labels_url":"https://api.github.com/repos/LPology/Simple-Ajax-Uploader/issues/125/labels{/name}","comments_url":"https://api.github.com/repos/LPology/Simple-Ajax-Uploader/issues/125/comments","events_url":"https://api.github.com/repos/LPology/Simple-Ajax-Uploader/issues/125/events","html_url":"https://github.com/LPology/Simple-Ajax-Uploader/issues/125","id":111747617,"number":125,"title":"Upload text from input field","user":{"login":"ConquerDeveloper","id":11775038,"avatar_url":"https://avatars.githubusercontent.com/u/11775038?v=3","gravatar_id":"","url":"https://api.github.com/users/ConquerDeveloper","html_url":"https://github.com/ConquerDeveloper","followers_url":"https://api.github.com/users/ConquerDeveloper/followers","following_url":"https://api.github.com/users/ConquerDeveloper/following{/other_user}","gists_url":"https://api.github.com/users/ConquerDeveloper/gists{/gist_id}","starred_url":"https://api.github.com/users/ConquerDeveloper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ConquerDeveloper/subscriptions","organizations_url":"https://api.github.com/users/ConquerDeveloper/orgs","repos_url":"https://api.github.com/users/ConquerDeveloper/repos","events_url":"https://api.github.com/users/ConquerDeveloper/events{/privacy}","received_events_url":"https://api.github.com/users/ConquerDeveloper/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-16T02:47:45Z","updated_at":"2015-10-16T04:08:02Z","closed_at":"2015-10-16T03:56:27Z","body":"Hello, first of all, thank you so much for developing simple ajax uploader.\r\n\r\nThe plugin works just fine for me, the only issue i have is that i'm trying to upload an input text field value and i'm sending it to the server but it doesn't work. It only works when i give it a default value. For example:\r\n\r\ndata: {title: \"hello world\"}\r\n\r\nbut doesn't work like this:\r\n\r\ndata: {title: document.getElementById('title').value}\r\n\r\nHow can i solve this? Thank you so much for your help!!!\r\n\r\nHere's my complete code:\r\n\r\n    function escapeTags(str) {\r\n        return String(str)\r\n            .replace(/&/g, '&amp;')\r\n            .replace(/\"/g, '&quot;')\r\n            .replace(/'/g, '&#39;')\r\n            .replace(/</g, '&lt;')\r\n            .replace(/>/g, '&gt;');\r\n    }\r\n\r\n    window.onload = function() {\r\n\r\n        var btn = document.getElementById('uploadBtn'),\r\n            progressBar = document.getElementById('progressBar'),\r\n            progressOuter = document.getElementById('progressOuter');                \r\n\r\n        var uploader = new ss.SimpleUpload({\r\n            button: btn,\r\n            url: 'index.php/file/upload/do_upload',\r\n            name: 'userfile',\r\n            method: \"POST\",\r\n            data: { title: document.getElementById(\"title\").value },\r\n            dataType: \"JSON\",\r\n            multipart: true,\r\n            hoverClass: 'hover',\r\n            focusClass: 'focus',\r\n            responseType: 'JSON',\r\n            debug: true,\r\n            autoSubmit: false,\r\n            startXHR: function () {\r\n                progressOuter.style.display = 'block'; // make progress bar visible\r\n                this.setProgressBar(progressBar);\r\n            },\r\n            onSubmit: function () {\r\n                $(\"#upload\").button(\"loading\");                \r\n            },\r\n            onComplete: function (filename, response) {\r\n                progressOuter.style.display = 'none'; // hide progress bar when upload is completed\r\n                $(\"#upload\").button(\"reset\");\r\n                if (!response) {\r\n                    console.log(filename + ' Unable to upload file ' + response);\r\n                    return;\r\n                }\r\n\r\n                if (response.success === true) {\r\n                    alert('<strong>' + escapeTags(filename) + '</strong>' + ' successfully uploaded.');\r\n\r\n                } else {\r\n                    if (response.msg) {\r\n                        console.log(escapeTags(response.msg));\r\n\r\n                    } else if (response.title) {\r\n                        console.log(escapeTags(response.title));\r\n                    } else {\r\n                        console.log('An error occurred and the upload failed.');\r\n                    }\r\n                }\r\n            },\r\n            onError: function (response) {\r\n                progressOuter.style.display = 'none';\r\n                alert('Unable to upload file ' + response);\r\n            }\r\n        }); \r\n        $(\"#upload\").click(function(){\r\n            uploader.submit();\r\n        });      \r\n    };"},"comment":{"url":"https://api.github.com/repos/LPology/Simple-Ajax-Uploader/issues/comments/148595218","html_url":"https://github.com/LPology/Simple-Ajax-Uploader/issues/125#issuecomment-148595218","issue_url":"https://api.github.com/repos/LPology/Simple-Ajax-Uploader/issues/125","id":148595218,"user":{"login":"ConquerDeveloper","id":11775038,"avatar_url":"https://avatars.githubusercontent.com/u/11775038?v=3","gravatar_id":"","url":"https://api.github.com/users/ConquerDeveloper","html_url":"https://github.com/ConquerDeveloper","followers_url":"https://api.github.com/users/ConquerDeveloper/followers","following_url":"https://api.github.com/users/ConquerDeveloper/following{/other_user}","gists_url":"https://api.github.com/users/ConquerDeveloper/gists{/gist_id}","starred_url":"https://api.github.com/users/ConquerDeveloper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ConquerDeveloper/subscriptions","organizations_url":"https://api.github.com/users/ConquerDeveloper/orgs","repos_url":"https://api.github.com/users/ConquerDeveloper/repos","events_url":"https://api.github.com/users/ConquerDeveloper/events{/privacy}","received_events_url":"https://api.github.com/users/ConquerDeveloper/received_events","type":"User","site_admin":false},"created_at":"2015-10-16T04:08:02Z","updated_at":"2015-10-16T04:08:02Z","body":"@LPology Thank you so much!!! It worked!!"}}