Jump to content

Send AJAX to "Mainform.form" from a other JS-Library


erich.wanker

Recommended Posts

Hello folks :-)

 

i use a JS-Library called "dropzone.js" ...

I added a line with "alert" and it works - i can see the alert in my UniGUI Webapplication

I added ->  ajaxRequest('MainForm.window','file_drop',['file='+file.name]);  and become Error "ajaxrequest not defined.." (i included prototype.js for this??)

 

 

 

What make i wrong in the "dropzone.js" ???

 

{   key: "processFile",
    value: function processFile(file) {

alert(file.name);
ajaxRequest('MainForm.window','file_drop',['file='+file.name]); 

      return this.processFiles([file]);
    }
    // Loads the file, then calls finishedLoading()
  }, 

 

Just for info .. The used UniURLFrame has:

UniURLFrame2.HTML.Append('<!DOCTYPE html> ');
UniURLFrame2.HTML.Append('<meta charset="utf-8">');
UniURLFrame2.HTML.Append('<title>Dropzone</title> ');

UniURLFrame2.HTML.Append('<style type="text/css">  ');
UniURLFrame2.HTML.Append('  body {   ');
UniURLFrame2.HTML.Append('         overflow:hidden;  ');
UniURLFrame2.HTML.Append('       } ');
UniURLFrame2.HTML.Append('</style>');


UniURLFrame2.HTML.Append('<body bgcolor="#95A3B3"> ');
UniURLFrame2.HTML.Append('<body style="margin: 0px;"> ');

UniURLFrame2.HTML.Append('<script src="/files/js/prototype.js"></script> '); 
UniURLFrame2.HTML.Append('<script src="/files/js/dropzone.js"></script>');

UniURLFrame2.HTML.Append('');
UniURLFrame2.HTML.Append('<link rel="stylesheet" href="/files/js/dropzone.css"> ');
UniURLFrame2.HTML.Append('');
UniURLFrame2.HTML.Append('<form action="/files/js/upload.php" class="dropzone"> ');
UniURLFrame2.HTML.Append('<input type="hidden" name="usernumber" value="'+mainform.benutzernummer+'">    ');
UniURLFrame2.HTML.Append('</form> ');

 

Link to comment
Share on other sites

Hi Delphi Developer,

 

 

i wrote "ajaxRequest(MainForm.window, ...." in the 3rd-party-Library .. and it says "(ajaxrequest) not defined"

 

i added "UniURLFrame2.HTML.Append('<script src="/vmo.dll/uni-1.0.0.1395/ext-unicommon-min.js"></script>');

So - the  "(ajaxrequest) not defined"-Error doesnt come ..
 
But now the browser says: Uncaught ReferenceError: MainForm is not defined

 

if i use quotes "MainForm.window"  .. nothing happens .. no error .. no ajax event...

 

 

 

I Think - i must use pure javascrip  ????  or how can i use the "ajaxRequest" function outside UniGui ??

 

 

 

Something like following code ?????  - but i have no idea how the code should look like to communicate with Mainform.form 

var json_upload = "json_name=" + JSON.stringify({file:"'+file.name+'"});
add eventname ????? 
var xmlhttp = new XMLHttpRequest();  
xmlhttp.open("POST", "??? UNIGui ???");
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send(json_upload);
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...