How to Write changes from HTML/JS files into DB ?
This is a basic query, if anyone can give me a quick hint how to write content from JS web apps to backend database...
most of the ext tools provide different ways as to how we can present data, reading content from backend in JSON/XML format. I was given excellent suggestions in my below thread on security issues and on reading from web service:
how about writing to backend database from client side using js ? i mean, if i want to write say a news article into database. User adds a bunch of details say author, date, pic, article text, short description, long decription bla bla bla...How do i pass all of these from js into backend.
1. I cant pass all of these in Headers as this is too long. i played around with GMail and tested what happens when we Compose a new mail. It is just handled on backend.
2. Do you think creating sessions is a good idea...? can it hold long articles text...?
3. Do i have to create XML/JSON file when user wants to create new article (wants to add content to database). Once user finishes his writing (think of a wizard sytle apps. where user is taken through 5-10 steps to provide detailed info) and then send this xml/json file to backend logic ?
4. In .Net web pages we write code directly in the page itself. So when the user submits, the submit_click event is fired and it undergoes N-tier arch code to perform the task. How to accomplish this using js...
Thank you in advance...
The reason that you never got a response to this question the first time you posted it is because it is waaaaay too broad. You are asking questions that are far too general and open-ended for anyone to be able to give you an appropriate answer in a forum post.
1. This doesn't even mean anything. Passing your data in "headers?" You mean HTTP headers?
2. Creating session is not a good idea or bad -- it all depends on what you're doing. But it certainly is not a data storage solution, which sounds like your question?
3. XML/JSON is just the data transfer format. You don't create a file, you just POST your data to the server -- the data formatting is generally handled by Ext and whatever server solution you're using.
4. "the submit_click event is fired and it undergoes N-tier arch code to perform the task." There are many, many ways to process a user-initiated event on both the server and the client. There are also many examples in Ext of doing this the JS way (look at the FeedViewer example application). You probably need to study up a little more on the general concepts and then ask questions about pieces that you're having trouble with.
... like trying to get somoene to do the entire job.
I break things down into little do-able parts.
my question was really simple...will come up with solution
My question might be too broad....but its really really simple.
1. How to write content from client side into DB using Ext tools using js? Its as simple as it is...
I know its non Ext query. becz. coming from Non-JS background and the only way to use these beautiful Ext tools is through js only something am learning from scratch.
Since am still evaluating these tools. I want to know, how to handle the stuff in such and such case in js.
yes, am surfing the net and learning JS on a daily basis. Will come up with solutions, when found...
Ext JS Premium Member
This is the job of your server-side script, not Ext. You need to POST your data (via ajax or via a normal form submission) to your server which then assumes responsibility for writing values to your DB.
Originally Posted by Mohammed
Well, unfotunately, it is not a simple question to answer as it can be done in many ways. Sounds like you are a .NET dev, so the most basic approach is to simply post (async or normal) to a .aspx page, and in the code-behind of that page, you would evaluate the HTTP form object if it's a POST (request object if it's a GET) to get your data, save it via your data access solution of choice, then format some kind of response that your client page is expecting (most people use JSON format for this). The drawback to this approach is that it's completely manual.
Originally Posted by Mohammed
Once you understand generally how the process works, you might want to look at Michael Schwarz's fantastic AjaxPro library, which can provide the server side interface that Ext would use (http://www.ajaxpro.info/) and handles all the JSON processing automatically. There are other similar libraries available if you Google ".NET Ajax" but AjaxPro works well and has been around for a while.
You should start there and see if you can get a simple example working. If you have issues getting it working, feel free to post your code. Using .NET and AjaxPro has also been discussed before on this forum if you search.
Thank you brian...
i have posted complete code and output in my blog here http://devaspects.com/blog/index.php?blog=6
hope it helps...