Welcome Guest, Not a member yet? Register   Sign In
$.jQuery.load() Partial HTML
#1

[eluser]Unknown[/eluser]
Hi,

I'm trying to load partial HTML into the main HTML using Jquery $.load(<url>, <data>, <callback>).

I realised a problem in linking to the partial HTML if I put the partial HTML inside the view. Any idea how can I keep the structure (shown below) of having my partial views inside the View folder and still able to use the $.load(<url>);

application
+-views
+-backend
+-partial
| +-contact_form.php
+-index.php
+-contact.php

Does modifying the route helps?

Cheers,
Mickey
#2

[eluser]clip[/eluser]
Code:
$partial = $this->load->view('partial/myview', $data, TRUE);
echo $partial;

Point to your controller/method maybe its something like post/ajaxview/3

You could also create a function that checks to see if the request url is ajax and build that logic into your controller to avoid creating one specificaly for ajax requests.




Theme © iAndrew 2016 - Forum software by © MyBB