0

I am having issues indexing documents JqueryAJAX. This is the code that I use:

 var data = {
                id: "hanah123", 
                weight: 1100,
                subject: "SOLR Testing",
                description: randomPhrase
            };

            var stuffToSend = [];

            stuffToSend.push(data);
 debugger;
            $.ajax({
                url: 'awsaddress:8983/solr/update/json?commit=true', 
                data: JSON.stringify(stuffToSend),
                type: 'POST',
                dataType: "json",
                crossDomain: true,
                success: function (data) {                         
                    console.log("And this is success: " + data);
                }

I enter success all the time, and this is the message that I receive:

"<?xml version="1.0" encoding="UTF-8"?>
  <response>
  <lst name="responseHeader"><int name="status">0</int><int name="QTime">5</int></lst>
 </response>
 "

What do I need to change to make it work?

Amiga500
  • 5,874
  • 10
  • 64
  • 117
  • "Read in many places" doesn't say much. You say that this duplicate question with answer did not help you? Just to note, this is the first hit to a google for "jetty cors": http://stackoverflow.com/questions/8303162/jetty-cross-origin-filter – Gimby Nov 10 '14 at 13:42
  • The only thing you did was mangle the question. You should edit it back, post the answer to the original question and ask a new question. – Gimby Nov 10 '14 at 14:51
  • I hope I made it ok this time. Please let me know if it still required work. :) – Amiga500 Nov 10 '14 at 14:54

1 Answers1

0

I finally made it work, and it was simple.

Just add the following to the AJAX setup:

 contentType: "text/plain"

I hope this helps someone.

Amiga500
  • 5,874
  • 10
  • 64
  • 117