Wikipedia:WikiProject User scripts/Guide/Ajax: Difference between revisions
Content deleted Content added
→Fetch page content: Use promises! |
→Using plain jQuery: Use promises! |
||
Line 67:
$.getJSON(
mw.util.wikiScript('api'),
'format=json&action=query&prop=revisions&rvprop=content&rvlimit=1&titles=Wikipedia:Sandbox'
)
for ( page in data.query.pages ) {
wikitext = data.query.pages[page].revisions[0]['*']; } catch ( e ) {▼
doSomethingInCaseOfError();▼
}
}
})
</source>
|