I have a web app using Next and another app using Node. I am wanting to pass data from my Node app to my Next one in the form of a JSON object. I can get the data into the Next API by using a POST request and that works, what I want to know is if there is a way to pass the data from the API file into a component?
Related
I have created a site dashboard which has 3 dashlets. The data required by 3 dashlets and displaying in different views.
Currently I am using rest api call using "connector.get" inside webscript1.get.js,webscript2.get.js and webscript3.get.js files. Repeatedly calling in all three dashlets.
My question is, can I call it once and share the object with all three dashlets? I tried doing this with surf root objects, but those objects are immutable. Please can any one help?
In this case what you can do is, save the response of your ajax call in one global javascript variable.When first time you are calling an api, it will call the api and then set the response of it to a global javascript variable.
In other dashlets you can check whether this variable is null or not, If not null you can use the data.
I have Tealium utag.sync.js loaded with adobe target at.js and visitor api js.
Application populates bunch of app data into utag_data (Universal Data Object)
Can this data available in Adobe Target to define rules around the data , to define activities( segments), Experiences ?
Are there any configurations that I need to do to propagate the data from tealium to Target ?
Thanks,
Sri
To start with there is a new version of the Adobe Target tag, currently in BETA, that is available for you to use, that will allow for data to be mapped from Tealium to Target.
If you would like to stick with having the full at.js in the utag.sync.js file, you will need to use one of the following target functions:
adobe.target.getOffer()
With this you will have to send a "fake" request for a mbox, passing in the data.
adobe.target.trackEvent()
Allows you to send an Event with data to Target. Using the mbox property as the event name.
window.targetPageParams()
Will allow you to append data to just the global mbox call request.
window.targetPageParamsAll()
Will allow you to append data to all requests going to Target
You will be able to use these functions within a JS extension where you can grab the current data object b, containing anything the utag has captured.
For more information on these calls, I would recommend reviewing the at.js documentation here.
I have used this to chain dynamic data drop downs in an Orbeon application using the following services:
1. /xforms-sandbox/service/zip-states
2. /xforms-sandbox/service/zip-cities?state-abbreviation={../state}
3. /xforms-sandbox/service/zip-zips?state-abbreviation={../state}&city={../city}
I have few questions:
I also want to create the same, so can you please point me the code where this services are present. How I should write the service in this case?
{../state} - How it retrieve the state value when it changed?
What is the use of state-abbreviation?
This specific test service is implemented in XPL and XSL, in zip-states.xpl. But it really just is a service that gets called with an HTTP GET by Orbeon Forms, and returns XML. BTW, you can easily test it from your browser, and it could be implemented with any technology.
Whenever the value of the control named state changes, {../state} will return a different value, so the URL for the service will change, so the Dynamic dropdown will load again that URL to retrieve potentially new data.
In this particular example, we want the "abbreviation" to be stored in the data (e.g. "CA"), and the full name (e.g. "California") to be shown in the UI. Again, in this particular examples, values come from states.xml.
I have an JSP, servlet application where I am using a java dashboard to display the grid data. For a specific project, I want to use the editable slickgrid. I have successfully integrated the grids to display data. But now, I need to send/post the data back to the servlet for processing. I referred to the question here Saving changes in SlickGrid and tried using the solution. But the script doesn't send any data to the servlet. At the servlet, when I collect the parameters passed and print them, I get:
In Test Data Input event.
1)event : TestDataInput
2)data :
If I modify the script line:
$("input[name='data']").val($.JSON.stringify(grid.getData()));
to
$("input[name='data']").val(grid.getData());
a lot of [object, object] variables are posted and collected in the servlet.
Can you tell me where am I making a mistake?
Thanks all in advance.
I want to maintain db cache(some keywords) in the servlet. When I am typing for 'a' I have 1000 keywords in Db which starts with 'a' and presently I am using js file to store all the keywords in cache. I want to maintain the DB cache in servlet also and decrease the browser cache and next hitting keyword matches in the servlet Db, I want to retrieve the top 10 keywords for the this hitting.
Can you tell me how can I create the servlet cache? Can you provide any pseudo code for that?
Thanks,
Murali
I can imagine you have a Servlet that accesses the Database in order to retrieve the top 10 keyboards based on the input delivered. That means whenever an A is pressed in the input field, you must use an XMLHttpRequest to call the servlet with that input.
The servlet should return you a list of keywords which you should parse and translate properly to your user again. (you could do this in multiple ways. An easy way is to just let the servlet respond with HTML for you,which you can set with Javascript in an element (innerHTML)).
As for caching, the servlet could use some cache and identify the requested input. You can build an own cache by generating a key from the input and the result of that input should be put into a Map.
You could also use an existing caching framework, like EHCache.