Ajax Call from an HTML page does not works

  • 784 Views
  • Last Post 14 January 2016
rx4hvn posted this 08 January 2016

http://ocrsdk.com/documentation/quick-start/work/

I am calling these urls using POSTMAN and works just fine. But in jQuery AJAX I could not figure out the code make those call.

$("form[name='uploader']").submit(function(e) {
    e.preventDefault();
    var formData = new FormData($(this)[0]);
    $.ajax({
        type: 'POST',
        url: '//cloud.ocrsdk.com/processImage?language=english&exportformat=txt',

        beforeSend: function(xhr,settings) { 
             //i am using application id and password here
            xhr.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
            return true;
        },
        crossDomain: true,
        data: formData,
        processData: false,
        success: function(responseData, textStatus, jqXHR) {
            console.log(responseData);
        },
        error: function (responseData, textStatus, errorThrown) {
            alert('POST failed.');
        }
    });
});

These calls dont work at all. Please check

Thanks in Advance!

Order By: Standard | Newest | Votes
Oksana Serdyuk posted this 08 January 2016

Please see the following posts concerning using ABBYY Cloud OCR SDK in AJAX:

And pay your attention to the fact that our Cloud OCR SDK service cannot work with data encoded in base64, it is necessary to pass binary data as is.

If the issue is still actual, kindly send to CloudOCRSDK@abbyy.com the logs from the Fiddler debugger (you can download it from www.fiddler2.com) or any of its analogue. The logs should include the headers, request content and the answer. Then We will show them to our developers for clarification of the issue.

rx4hvn posted this 08 January 2016

You are showing Javascript with nodejs. I have not got my answer properly. If this can be done with AJAX, jQuery not nodejs? If yes what is the issue in my code?

Oksana Serdyuk posted this 14 January 2016

We have not got a ready sample code or instructions for using ABBYY Cloud OCR SDK in jQuery AJAX.

To debug your code we recommend to use any HTTP debugger (for example, Fiddler). If you send the logs to CloudOCRSDK@abbyy.com, we will be able to show them the developers for investigation the issue.

Close