I have a view that returns data to a template using the render_to_response function, as shown below:
@page_template("app/jsComp.html")
Ability to view contextual data in my template (jsComp.html) using the notation below
// Global variable jdata {% if wc_V_json %} jdata = {{ wc_V_json|safe }}; {% endif %} alert('Sk: '+JSON.stringify(jdata));
I wanted to use this template myself inside a div in another template, say index.html. Also, I would like to send the id from index.html via an angularjs ajax call. therefore, my view should take into account that cid is equal to the value that I pass through angular ones.
My question is: how can I do this in index.html?
$scope.preview_ang = function (clicked_id) { $http({ method: 'POST', url: 'pvcan', data: { 'id': clicked_id }, headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) .success(function (data) { if (data == "null") { alert('server returned nothing but success'); } else {
What should I write in the success function of my angularjs ajax call to render jsComp.html in a div with some id in index.html ?? Could you help me with the approach?
I know that I can use something like this, but it does not work (I tried calling load_page in the success function, but did not use it. How can I achieve this requirement?
function load_page(){ document.getElementById("info").innerHTML='<object type="text/html" data="previewcan" style="width:100%;height:100%;"></object>'; }
Tried below in the view, but it does not work - (Request, Reply)
@page_template("app/jsComp.html")
angularjs django django-views
Sathish Jan 14 '16 at 13:53 on 2016-01-14 13:53
source share