PrepAway - Latest Free Exam Questions & Answers

Which code segment should you insert at line 05?

You develop a web application by using jQuery. You develop the following jQuery code: (Line
numbers are included for reference only.)

The web application exposes a RESTful web API that has an endpoint of/product/create.
You need to create a new product by using AJAX.
Which code segment should you insert at line 05?

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

2 Comments on “Which code segment should you insert at line 05?

  1. banshee says:

    And why not A? A and D differs only with ‘dataType’, because ‘contentType’ in A (“application/x-www-form-urlencoded; charset=UTF-8”) is default ‘contentType’ and in D there is no ‘contentType’, so this is also default. Additionally, we don’t know what is expected to be back from the server – if it should be xml or json (it is not included in question or code). So what is the reason that D is the correct answer?




    1



    0
  2. aleksey says:

    banshee, documentation of jquery ajax says: If xml is specified, the response is parsed using jQuery.parseXML before being passed, as an XMLDocument, to the success handler. So, you can not simple type “result.message” how it is in question code sample. So it is json.




    2



    0

Leave a Reply