0

If I want an article, which exactly match the page query (e.g. if it's "dog"), then there's no problem, however, if it doesn't match exactly (e.g. "red dog"), then I see: "Red dog or Red Dog may refer to:" and nothing after this sentence. There's no article with references. I'm not so sure where's the problem, or how to fix it.

    $.ajax({
        url: urls,
        data: {
            format: "json",
            action: "parse",
            page: match[1],
            prop:"text",
            section:0,
        },
        dataType: 'jsonp',
        headers: {
            'Api-User-Agent': 'Example/1.1 (https://www.example.tech/; 
             admin@example.tech) BasedOnUnisoftdevScipt/1.0'
            },
            success: function (data) {
                console.log(data)        
                var markup = data.parse.text["*"];
                var i = $('<div></div>').html(markup);
                i.find('a').each(function() { 
                    $(this).replaceWith($(this).html()); });
                    i.find('sup').remove();
                    i.find('.mw-ext-cite-error').remove();
                    var rplo ='<p>~ Chatbot wrote: <q id="writeajaxed"></q></p>';
                    $('#context').html(youwrote  + message + '</q></p>' + rplo);
                    $('#writeajaxed').html($(i).find('p'));

                }
    });

Thnx

Juraj
  • 62
  • 3
  • 1
    You are requesting section 0 (ie. the part before the first section heading) of [Red dog](https://en.wikipedia.org/wiki/Red_dog), and you are getting exactly what you asked for. – Tgr Apr 14 '17 at 21:02
  • Thnx for your answer – Juraj Apr 15 '17 at 17:11

0 Answers0