P
P
Perkovec2014-11-15 08:10:06
JavaScript
Perkovec, 2014-11-15 08:10:06

Using PasteBin API in Javascript?

I need to send the code to PasteBin via their Api, this is how I do it

$.ajax({
    url: "http://pastebin.com/api/api_post.php",
    type: "POST",
    dataType: "JSONP",
    data: {
        "api_dev_key": "9c3ccefe915590a6fd979be4f2a54f27",
        "api_option": "paste",
        "api_paste_code": "blah blah",
        "api_paste_expire_date":"10M",
        "api_paste_private":"0"
    },
    success: function(res) {
        console.log(res);
    },
    error: function(res) {
        console.log("Error");
    }
});

Chrome starts swearing "SyntaxError: Unexpected identifier" and Ajax request displays "Error"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WEB_champion, 2014-11-15
@WEB_champion

What for a zero and in general numbers to wrap in inverted commas?
"api_paste_private": 0 - try this, maybe that's the issue! Yes, that's not the point.
In general, how can chrome swear at the js syntax, if it is an Ayak request, but it is in js?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question