jQuery UI Widgets Forums Editors FileUpload Resource interpreted as Document but transferred with MIME type …

This topic contains 6 replies, has 4 voices, and was last updated by  Hristo 2 years, 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author

  • rbossy
    Participant

    Hi,

    Using jqxFileUpload, I get:

    Resource interpreted as Document but transferred with MIME type application/json: "http://localhost:8080/...".

    The URL is indeed a REST point that produces JSON. However I didn’t expect it to be read as HTML by default. Is there a way to tell the widget the response will be in JSON so that we get the response as an object?

    At the moment, the response data (event.args.response from uploadEnd) is a string containing the JSON embedded in a pre tag. I suppose I could somehow extract and parse my data, but it just seems awkward. I’d rather declaratively tell the expected response format, or even write a hook function if necessary.

    Btw, I’m using version 3.9.0.

    Thanks,
    Robert


    Dimitar
    Participant

    rbossy
    Participant

    Dear Dimitar,

    Thanks for the quick answer, I should defenitely check SO before posting here, sorry for that. The first link was sort of helpful but rather incomplete I’m afraid.

    The good news is that there is a solution that worked for me: to change the server response MIME to text/html. args.event.response is then a string containing the JSON; I can parse it. However I’m fortunate enough to have control over the server process, that might not be a suitable solution in everey case.

    Another proposed solution was to remove multipart/form-data, but this is not possible when uploading files.

    Another one wat to add a query string to the URL, didn’t work for me (I was suspicious about this solution anyway).

    Finally, apparently, the definite solution is to use $.post instead of ajaxSubmit. However I suspect this call is buried somewhere in jqxfileupload.js or jquery-1.11.1.min.js.

    Here’s the stack trace I get from Chromium, if it is of any value:

    Resource interpreted as Document but transferred with MIME type application/json: “http://localhost:8080/…”.
    a.extend._uploadFile @ jqxfileupload.js:7
    (anonymous function) @ jqxfileupload.js:7
    m.event.dispatch @ jquery-1.11.1.min.js:3
    r.handle @ jquery-1.11.1.min.js:3

    Thank you very much, jqxWidgets is fantastic,
    Robert

    Edit: hid the URL

    • This reply was modified 7 years, 1 month ago by  rbossy.

    Usama
    Participant

    Hi,
    I am new in JQWidgets, I am trying to integrate it with SharePoint 2019, all the js files are working fine, but the issue is only with css files. below is how I linked one of the css files on the SharePoint page.

    <link rel=”stylesheet” href=”/sites/test/SiteAssets/css/jqx.base.css” type=”text/css” />

    but getting the below error message,

    Resource interpreted as Stylesheet but transferred with MIME type application/octet-stream: “http:/server/sites/test/SiteAssets/css/jqx.base.css”.

    Please help me in this regards.
    Thanks
    Hafiz Muhamad Usama


    Hristo
    Participant

    Hello Hafiz Muhamad Usama,

    Could you provide us with more details?
    It will be better if you could provide us with one simplified example that demonstrates your case.
    Also, I hope you try the suggestion of my colleague:
    https://www.jqwidgets.com/community/topic/resource-interpreted-as-document-but-transferred-with-mime-type/#post-79267
    I think this tutorial will be helpful, too.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com


    Usama
    Participant

    Hy, Hristo, thanks for your response, I was not available since last two days because of illness. I am feeling good now.

    Yes I defiantly checked the above suggestion before posting the above query. But the issue was something else.
    Solution is as below:
    Basically the Css link <link rel=”stylesheet” href=”/sites/test/SiteAssets/css/jqx.light.css” type=”text/css” /> that JS code appends with DOM was not at the correct place in to the SharePoint page after <link rel=”stylesheet” href=”../SiteAssets/JQ/jqwidgets/styles/jqx.base.css” media=”screen”>.

    It must be after the jqx.base.css link as shown below

    <meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1 minimum-scale=1">
    <link rel="stylesheet" href="../SiteAssets/JQ/jqwidgets/styles/jqx.base.css" media="screen">
    <link rel="stylesheet" href="../SiteAssets/JQ/jqwidgets/styles/jqx.light.css" media="screen">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    Another issue was the grid was not render at all.
    Solution is as below:
    Basically the SharePoint encloses the overall html code into a dive with class class=”ms-rtestate-field” on the page. with fixed height 37px. we should set the height based on our requirement once document ready.

    Hopefully this solution will help someone.

    Thanks
    Hafiz Muhammad usama
    usama.fastnu@gmail.com

    • This reply was modified 2 years, 2 months ago by  Usama. Reason: corrected the code
    • This reply was modified 2 years, 2 months ago by  Usama. Reason: corrected the link

    Hristo
    Participant

    Hello Hafiz,

    Thank you for your contribution.
    Definitely, it will be helpful for someone else.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.