I am trying to capture the Search Type in following script code and this code has been written in Data Element in DTM. I am facing issue with that how to set condition in Rule so that i can send this data element result to the prop17.
I think that your jQuery is running too late to be useful. Think of the sequence this way:
1) DTM detects a click on an 'A' element and your rule is triggered.
2) In your custom condition, DTM evaluates the data element, "Search Result Position". In this evaluation, it sets up an event listener on the specific element clicked and returns undefined. I honestly don't know what would happen if the rule ran a second time on the same page. Anyway, It's pretty rare that you would need to directly set up event listeners in DTM or Launch. If you're interested, here's a great article on the topic - https://medium.com/launch-by-adobe/event-detection-from-dtm-to-launch-b4370cc21bb8
Instead, try doing this.
In your rule's custom condition, write this code.
var searchResultCount = $(this).parents(".lia-message-view-wrapper").index()+1;
^^^ This works by creating a data element on the fly which can be referenced later. Be careful not to use a data element name that has been used in the UI because they cannot be set via _satellite.setVar.
In the same scenario I created a Data Element (written custom script to capture the "q" parameter from the URL) for Internal Site Search, and mapped this DE with eVar in Page Load rule.
But this works when page load e.g. I opened website and searched "test" redirected to the search result page and this DE capture the value and send data to the AA. When I searched 2nd time "test2", page doesn't load and this "q" parameter wasn't captured although value has changed in the URL "q" parameter.
Could you please help me in this to capture the "q" parameter directly from the URL without loading a page.