-2

I wonder if there is an easy way to delete a file from Parse.com without using cURL and PHP.

I'm looking for kind of a javascript/jQuery solution, because I'm not really into cURL and PHP.

Has anyone already had the same issue and could give a hint, how to solve this?

I know, I should post some code on SO and what I have tried so far. But I don't really have a starting point, without the compulsion to become aquainted to cURL, REST and PHP.

Any proposal where to start, or hints to tutorials would help.

This post here suggests that you can make a REST call per AJAX.

I tried by:

    $.ajax({
        url: wohnung.get("Bild"),
        X-Parse-Application-Id: 'myId',
        X-Parse-Master-Key: 'myKey',
        type: 'DELETE',
        success: function() { alert('delete completed'); }
    });

But it tells me there is an unexpected identifier in the line with the ID. Can't I pass parameters this way!?

Community
  • 1
  • 1
Igl3
  • 4,900
  • 5
  • 35
  • 69
  • 1
    It would be awesome if I could delete any image from any dot com site – Emmanuel John Jan 12 '14 at 08:01
  • Exposing your Master Key in script like that is just asking for trouble, as once someone has your Master Key they can do anything they like. Consider calling Cloud Code or some other hosted code that then checks permissions and internally uses the Master Key without exposing it. – Timothy Walters Jan 13 '14 at 22:57

1 Answers1

0

There's a BIG chance you can't do this with JavaScript because of the same origin policy. (Assuming parse.com is not the domain where your scripts run)

http://en.wikipedia.org/wiki/Same-origin_policy

halfer
  • 19,824
  • 17
  • 99
  • 186
Edgar Villegas Alvarado
  • 18,204
  • 2
  • 42
  • 61
  • Okay, I see. I updated my question, because I tried via AJAX, maybe you could help me there, explaining what i did wrong. – Igl3 Jan 12 '14 at 08:15