Changing the Global Setup
$.ajaxSetup({url:"service.php", accepts:"json})
jQuery provides the .ajaxSetup()
method that allows you to specify options that configure AJAX requests throughout the script. Table 13.2 lists some of the options that can be specified when calling .ajaxSetup()
. For example, the following code sets the default global URL for requests:
$.ajaxSetup({url:"service.php", accepts:"json})
Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.